public class ScheduledExecutorServiceWrapper extends Object implements ScheduledExecutorService, org.apache.aries.util.tracker.SingleServiceTracker.SingleServiceListener
It also wraps the Runnables and Callables so when a task is canceled we quickly clean up memory rather than waiting for the target to get to the task and purge it.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ScheduledExecutorServiceWrapper.ScheduledExecutorServiceFactory |
| Constructor and Description |
|---|
ScheduledExecutorServiceWrapper(org.osgi.framework.BundleContext context,
String name,
ScheduledExecutorServiceWrapper.ScheduledExecutorServiceFactory sesf) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable command) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
<V> ScheduledFuture<V> |
schedule(Callable<V> callable,
long delay,
TimeUnit unit) |
ScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit) |
ScheduledFuture<?> |
scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit) |
ScheduledFuture<?> |
scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit) |
void |
serviceFound() |
void |
serviceLost() |
void |
serviceReplaced() |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
public ScheduledExecutorServiceWrapper(org.osgi.framework.BundleContext context,
String name,
ScheduledExecutorServiceWrapper.ScheduledExecutorServiceFactory sesf)
public boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionTimeoutExceptionpublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic <T> Future<T> submit(Callable<T> task)
submit in interface ExecutorServicepublic Future<?> submit(Runnable task)
submit in interface ExecutorServicepublic <T> Future<T> submit(Runnable task, T result)
submit in interface ExecutorServicepublic ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
schedule in interface ScheduledExecutorServicepublic <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
schedule in interface ScheduledExecutorServicepublic ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
scheduleAtFixedRate in interface ScheduledExecutorServicepublic ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
scheduleWithFixedDelay in interface ScheduledExecutorServicepublic void serviceFound()
serviceFound in interface org.apache.aries.util.tracker.SingleServiceTracker.SingleServiceListenerpublic void serviceLost()
serviceLost in interface org.apache.aries.util.tracker.SingleServiceTracker.SingleServiceListenerpublic void serviceReplaced()
serviceReplaced in interface org.apache.aries.util.tracker.SingleServiceTracker.SingleServiceListenerCopyright © 2009-2015 The Apache Software Foundation. All Rights Reserved.