Class BoundedScheduledExecutorService
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.util.concurrent.ForwardingExecutorService
com.google.common.util.concurrent.ForwardingListeningExecutorService
org.apache.bookkeeper.common.util.BoundedScheduledExecutorService
- All Implemented Interfaces:
com.google.common.util.concurrent.ListeningExecutorService,com.google.common.util.concurrent.ListeningScheduledExecutorService,Executor,ExecutorService,ScheduledExecutorService
public class BoundedScheduledExecutorService
extends com.google.common.util.concurrent.ForwardingListeningExecutorService
implements com.google.common.util.concurrent.ListeningScheduledExecutorService
Implements
ListeningScheduledExecutorService and allows limiting the number
of tasks to be scheduled in the thread's queue.-
Constructor Summary
ConstructorsConstructorDescriptionBoundedScheduledExecutorService(ScheduledThreadPoolExecutor thread, int maxTasksInQueue) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.common.util.concurrent.ListeningExecutorServicedelegate()voidinvokeAll(Collection<? extends Callable<T>> tasks) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TinvokeAny(Collection<? extends Callable<T>> tasks) <T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) com.google.common.util.concurrent.ListenableScheduledFuture<?><V> com.google.common.util.concurrent.ListenableScheduledFuture<V>com.google.common.util.concurrent.ListenableScheduledFuture<?>scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) com.google.common.util.concurrent.ListenableScheduledFuture<?>scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) com.google.common.util.concurrent.ListenableFuture<?><T> com.google.common.util.concurrent.ListenableFuture<T><T> com.google.common.util.concurrent.ListenableFuture<T>Methods inherited from class com.google.common.util.concurrent.ForwardingExecutorService
awaitTermination, isShutdown, isTerminated, shutdown, shutdownNowMethods inherited from class com.google.common.collect.ForwardingObject
toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, isShutdown, isTerminated, shutdown, shutdownNowMethods inherited from interface com.google.common.util.concurrent.ListeningScheduledExecutorService
schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay
-
Constructor Details
-
BoundedScheduledExecutorService
-
-
Method Details
-
delegate
protected com.google.common.util.concurrent.ListeningExecutorService delegate()- Specified by:
delegatein classcom.google.common.util.concurrent.ForwardingListeningExecutorService
-
schedule
public com.google.common.util.concurrent.ListenableScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) - Specified by:
schedulein interfacecom.google.common.util.concurrent.ListeningScheduledExecutorService- Specified by:
schedulein interfaceScheduledExecutorService
-
schedule
public <V> com.google.common.util.concurrent.ListenableScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) - Specified by:
schedulein interfacecom.google.common.util.concurrent.ListeningScheduledExecutorService- Specified by:
schedulein interfaceScheduledExecutorService
-
scheduleAtFixedRate
public com.google.common.util.concurrent.ListenableScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) - Specified by:
scheduleAtFixedRatein interfacecom.google.common.util.concurrent.ListeningScheduledExecutorService- Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService
-
scheduleWithFixedDelay
public com.google.common.util.concurrent.ListenableScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) - Specified by:
scheduleWithFixedDelayin interfacecom.google.common.util.concurrent.ListeningScheduledExecutorService- Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService- Specified by:
submitin interfacecom.google.common.util.concurrent.ListeningExecutorService- Overrides:
submitin classcom.google.common.util.concurrent.ForwardingListeningExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService- Specified by:
submitin interfacecom.google.common.util.concurrent.ListeningExecutorService- Overrides:
submitin classcom.google.common.util.concurrent.ForwardingListeningExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Specified by:
invokeAllin interfacecom.google.common.util.concurrent.ListeningExecutorService- Overrides:
invokeAllin classcom.google.common.util.concurrent.ForwardingExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Specified by:
invokeAllin interfacecom.google.common.util.concurrent.ListeningExecutorService- Overrides:
invokeAllin classcom.google.common.util.concurrent.ForwardingExecutorService- Throws:
InterruptedException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAnyin interfaceExecutorService- Overrides:
invokeAnyin classcom.google.common.util.concurrent.ForwardingExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAnyin interfaceExecutorService- Overrides:
invokeAnyin classcom.google.common.util.concurrent.ForwardingExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
submit
- Specified by:
submitin interfaceExecutorService- Specified by:
submitin interfacecom.google.common.util.concurrent.ListeningExecutorService- Overrides:
submitin classcom.google.common.util.concurrent.ForwardingListeningExecutorService
-
execute
-