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 Details

  • Method Details

    • delegate

      protected com.google.common.util.concurrent.ListeningExecutorService delegate()
      Specified by:
      delegate in class com.google.common.util.concurrent.ForwardingListeningExecutorService
    • schedule

      public com.google.common.util.concurrent.ListenableScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
      Specified by:
      schedule in interface com.google.common.util.concurrent.ListeningScheduledExecutorService
      Specified by:
      schedule in interface ScheduledExecutorService
    • schedule

      public <V> com.google.common.util.concurrent.ListenableScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
      Specified by:
      schedule in interface com.google.common.util.concurrent.ListeningScheduledExecutorService
      Specified by:
      schedule in interface ScheduledExecutorService
    • scheduleAtFixedRate

      public com.google.common.util.concurrent.ListenableScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
      Specified by:
      scheduleAtFixedRate in interface com.google.common.util.concurrent.ListeningScheduledExecutorService
      Specified by:
      scheduleAtFixedRate in interface ScheduledExecutorService
    • scheduleWithFixedDelay

      public com.google.common.util.concurrent.ListenableScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
      Specified by:
      scheduleWithFixedDelay in interface com.google.common.util.concurrent.ListeningScheduledExecutorService
      Specified by:
      scheduleWithFixedDelay in interface ScheduledExecutorService
    • submit

      public <T> com.google.common.util.concurrent.ListenableFuture<T> submit(Callable<T> task)
      Specified by:
      submit in interface ExecutorService
      Specified by:
      submit in interface com.google.common.util.concurrent.ListeningExecutorService
      Overrides:
      submit in class com.google.common.util.concurrent.ForwardingListeningExecutorService
    • submit

      public com.google.common.util.concurrent.ListenableFuture<?> submit(Runnable task)
      Specified by:
      submit in interface ExecutorService
      Specified by:
      submit in interface com.google.common.util.concurrent.ListeningExecutorService
      Overrides:
      submit in class com.google.common.util.concurrent.ForwardingListeningExecutorService
    • invokeAll

      public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
      Specified by:
      invokeAll in interface ExecutorService
      Specified by:
      invokeAll in interface com.google.common.util.concurrent.ListeningExecutorService
      Overrides:
      invokeAll in class com.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:
      invokeAll in interface ExecutorService
      Specified by:
      invokeAll in interface com.google.common.util.concurrent.ListeningExecutorService
      Overrides:
      invokeAll in class com.google.common.util.concurrent.ForwardingExecutorService
      Throws:
      InterruptedException
    • invokeAny

      public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
      Specified by:
      invokeAny in interface ExecutorService
      Overrides:
      invokeAny in class com.google.common.util.concurrent.ForwardingExecutorService
      Throws:
      InterruptedException
      ExecutionException
    • invokeAny

      public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
      Specified by:
      invokeAny in interface ExecutorService
      Overrides:
      invokeAny in class com.google.common.util.concurrent.ForwardingExecutorService
      Throws:
      InterruptedException
      ExecutionException
      TimeoutException
    • submit

      public <T> com.google.common.util.concurrent.ListenableFuture<T> submit(Runnable task, T result)
      Specified by:
      submit in interface ExecutorService
      Specified by:
      submit in interface com.google.common.util.concurrent.ListeningExecutorService
      Overrides:
      submit in class com.google.common.util.concurrent.ForwardingListeningExecutorService
    • execute

      public void execute(Runnable command)
      Specified by:
      execute in interface Executor
      Overrides:
      execute in class com.google.common.util.concurrent.ForwardingExecutorService