Package com.atlassian.jira.util
Class BoundedExecutorServiceWrapper
java.lang.Object
com.atlassian.jira.util.BoundedExecutorServiceWrapper
- All Implemented Interfaces:
ExecutorServiceWrapper
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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.boolean
<O> io.atlassian.util.concurrent.Promise<O>
-
Method Details
-
submit
- Specified by:
submit
in interfaceExecutorServiceWrapper
-
awaitTermination
public boolean awaitTermination()Shutdown thread pool and block until it is drained using the configured timeout.- Specified by:
awaitTermination
in interfaceExecutorServiceWrapper
- Returns:
- true if the executor service has been shutdown.
-
awaitTermination
Shutdown thread pool and block until it is drained.- Specified by:
awaitTermination
in interfaceExecutorServiceWrapper
- Parameters:
timeout
- the shutdown timeoutunit
- the shutdown timeout unit- Returns:
- true if the executor service has been shutdown.
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminated
in interfaceExecutorServiceWrapper
-