com.atlassian.jira.util
Class BoundedExecutorServiceWrapper

java.lang.Object
  extended by com.atlassian.jira.util.BoundedExecutorServiceWrapper

public final class BoundedExecutorServiceWrapper
extends Object

Wraps an ExecutorService to ensure the number of queued tasks is bounded to the specified concurrency. Submission of tasks will block until a thread is available. Construct using a BoundedExecutorServiceWrapper.Builder.

Since:
v6.3

Nested Class Summary
static class BoundedExecutorServiceWrapper.Builder
           
 
Method Summary
 boolean awaitTermination()
          Shutdown thread pool and block until it is drained using the configured timeout.
 boolean awaitTermination(long timeout, TimeUnit unit)
          Shutdown thread pool and block until it is drained.
<O> com.atlassian.util.concurrent.Promise<O>
submit(Callable<O> job)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

submit

public <O> com.atlassian.util.concurrent.Promise<O> submit(Callable<O> job)

awaitTermination

public boolean awaitTermination()
Shutdown thread pool and block until it is drained using the configured timeout.

Returns:
true if the executor service has been shutdown.

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
Shutdown thread pool and block until it is drained.

Parameters:
timeout - the shutdown timeout
unit - the shutdown timeout unit
Returns:
true if the executor service has been shutdown.


Copyright © 2002-2014 Atlassian. All Rights Reserved.