public class SingleThreadSchedulerServiceWrapper
extends java.lang.Object
SingleThreadScheduler to be a drop in replacement for any
ScheduledExecutorService (AKA the
ScheduledThreadPoolExecutor
interface). It does make some performance sacrifices to adhere to this interface, but those are
pretty minimal. The largest compromise in here is easily scheduleAtFixedRate (which you should
read the javadocs for if you need).| Constructor and Description |
|---|
SingleThreadSchedulerServiceWrapper(SingleThreadScheduler scheduler)
Constructs a new wrapper to adhere to the
ScheduledExecutorService interface. |
SingleThreadSchedulerServiceWrapper(SingleThreadScheduler scheduler,
TaskPriority taskPriority)
Constructs a new wrapper to adhere to the
ScheduledExecutorService interface. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable task) |
<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 task,
long delay,
java.util.concurrent.TimeUnit unit) |
ListenableScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable task,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit) |
ListenableScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable task,
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) |
public SingleThreadSchedulerServiceWrapper(SingleThreadScheduler scheduler)
ScheduledExecutorService interface.scheduler - scheduler implementation to rely onpublic SingleThreadSchedulerServiceWrapper(SingleThreadScheduler scheduler, TaskPriority taskPriority)
ScheduledExecutorService interface.scheduler - scheduler implementation to rely ontaskPriority - Priority for all tasks submitted to the parent schedulerpublic void shutdown()
public java.util.List<java.lang.Runnable> shutdownNow()
public boolean isTerminated()
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServicepublic <T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
submit in interface java.util.concurrent.ExecutorServicepublic <T> ListenableFuture<T> submit(java.lang.Runnable task, T result)
submit in interface java.util.concurrent.ExecutorServicepublic ListenableFuture<?> submit(java.lang.Runnable task)
submit in interface java.util.concurrent.ExecutorServicepublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException
invokeAll in interface java.util.concurrent.ExecutorServicejava.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
invokeAll in interface java.util.concurrent.ExecutorServicejava.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.ExecutorServicejava.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.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic void execute(java.lang.Runnable task)
execute in interface java.util.concurrent.Executorpublic ListenableScheduledFuture<?> schedule(java.lang.Runnable task, long delay, java.util.concurrent.TimeUnit unit)
schedule 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 java.util.concurrent.ScheduledExecutorServicepublic ListenableScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable task, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
scheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorServicepublic ListenableScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable task, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
scheduleAtFixedRate in interface java.util.concurrent.ScheduledExecutorService