java.util.concurrent.ExecutorService Maven / Gradle / Ivy
The newest version!
// CHECKSTYLE_OFF: Copyrighted to Guava Authors.
/*
* Copyright (C) 2017 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// CHECKSTYLE_ON
package java.util.concurrent;
import java.util.Collection;
import java.util.List;
/**
* Emulation of ExecutorService.
*/
public interface ExecutorService extends Executor {
void shutdown();
List shutdownNow();
boolean isShutdown();
boolean isTerminated();
// Blocking calls cannot be emulated on web. Subclasses of this class in shared code should mark
// their override with @GwtIncompatible.
// @GwtIncompatible("blocking")
// boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException;
Future submit(Callable task);
Future submit(Runnable task, T result);
Future> submit(Runnable task);
// Even though invokeAll and invokeAy methods below are blocking, they actually block on execution
// of the task that is provided hence could be emulated by directly executing them.
List> invokeAll(Collection extends Callable> tasks)
throws InterruptedException;
List> invokeAll(
Collection extends Callable> tasks, long timeout, TimeUnit unit)
throws InterruptedException;
T invokeAny(Collection extends Callable> tasks)
throws InterruptedException, ExecutionException;
T invokeAny(Collection extends Callable> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException;
}