class SameThreadScheduledExecutorService extends java.util.concurrent.AbstractExecutorService implements ListeningScheduledExecutorService
See TestingExecutors.sameThreadScheduledExecutor() for a full list of constraints.
| Modifier and Type | Class and Description |
|---|---|
private static class |
SameThreadScheduledExecutorService.ImmediateScheduledFuture<V> |
| Modifier and Type | Field and Description |
|---|---|
private ListeningExecutorService |
delegate |
| Constructor and Description |
|---|
SameThreadScheduledExecutorService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable command) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
<V> ListenableScheduledFuture<V> |
schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit) |
ListenableScheduledFuture<?> |
schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit) |
ListenableScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit) |
ListenableScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit) |
void |
shutdown() |
java.util.List<java.lang.Runnable> |
shutdownNow() |
<T> ListenableFuture<T> |
submit(java.util.concurrent.Callable<T> task) |
ListenableFuture<?> |
submit(java.lang.Runnable task) |
<T> ListenableFuture<T> |
submit(java.lang.Runnable task,
T result) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitschedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelayprivate final ListeningExecutorService delegate
public void shutdown()
shutdown in interface java.util.concurrent.ExecutorServicepublic java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow in interface java.util.concurrent.ExecutorServicepublic boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServicepublic boolean isTerminated()
isTerminated in interface java.util.concurrent.ExecutorServicepublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
submit in interface ListeningExecutorServicesubmit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServiceListenableFuture representing pending completion of the taskpublic <T> ListenableFuture<T> submit(java.lang.Runnable task, T result)
submit in interface ListeningExecutorServicesubmit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServiceListenableFuture representing pending completion of the taskpublic ListenableFuture<?> submit(java.lang.Runnable task)
submit in interface ListeningExecutorServicesubmit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServiceListenableFuture representing pending completion of the taskpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException
ListeningExecutorServiceAll elements in the returned list must be ListenableFuture instances. The easiest
way to obtain a List<ListenableFuture<T>> from this method is an unchecked (but safe)
cast:
@SuppressWarnings("unchecked") // guaranteed by invokeAll contractList<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks);
invokeAll in interface ListeningExecutorServiceinvokeAll in interface java.util.concurrent.ExecutorServiceinvokeAll in class java.util.concurrent.AbstractExecutorServiceListenableFuture instances representing the tasks, in the same
sequential order as produced by the iterator for the given task list, each of which has
completed.java.lang.InterruptedExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
ListeningExecutorServiceAll elements in the returned list must be ListenableFuture instances. The easiest
way to obtain a List<ListenableFuture<T>> from this method is an unchecked (but safe)
cast:
@SuppressWarnings("unchecked") // guaranteed by invokeAll contractList<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks, timeout, unit);
invokeAll in interface ListeningExecutorServiceinvokeAll in interface java.util.concurrent.ExecutorServiceinvokeAll in class java.util.concurrent.AbstractExecutorServiceListenableFuture instances representing the tasks, in the same
sequential order as produced by the iterator for the given task list. If the operation did
not time out, each task will have completed. If it did time out, some of these tasks will
not have completed.java.lang.InterruptedExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
invokeAny in interface java.util.concurrent.ExecutorServiceinvokeAny in class java.util.concurrent.AbstractExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
invokeAny in interface java.util.concurrent.ExecutorServiceinvokeAny in class java.util.concurrent.AbstractExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorpublic ListenableScheduledFuture<?> schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)
schedule in interface ListeningScheduledExecutorServiceschedule in interface java.util.concurrent.ScheduledExecutorServicepublic <V> ListenableScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit)
schedule in interface ListeningScheduledExecutorServiceschedule in interface java.util.concurrent.ScheduledExecutorServicepublic ListenableScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
scheduleAtFixedRate in interface ListeningScheduledExecutorServicescheduleAtFixedRate in interface java.util.concurrent.ScheduledExecutorServicepublic ListenableScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
scheduleWithFixedDelay in interface ListeningScheduledExecutorServicescheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorService