org.oddjob.scheduling
Class ExecutorServiceThrottle

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by org.oddjob.scheduling.ExecutorServiceThrottle
All Implemented Interfaces:
Executor, ExecutorService

public class ExecutorServiceThrottle
extends AbstractExecutorService

An ExecutorService that limits the number of Runnables running.

Work will be executed in the order in which it was submitted.

Author:
rob

Constructor Summary
ExecutorServiceThrottle(ExecutorService delegate, int threads)
           
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 void execute(Runnable command)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
 void shutdown()
           
 List<Runnable> shutdownNow()
           
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutorServiceThrottle

public ExecutorServiceThrottle(ExecutorService delegate,
                               int threads)
Method Detail

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Throws:
InterruptedException

isShutdown

public boolean isShutdown()

isTerminated

public boolean isTerminated()

shutdown

public void shutdown()

shutdownNow

public List<Runnable> shutdownNow()

execute

public void execute(Runnable command)