Package com.atlassian.jira.util
Class BoundedExecutorServiceWrapper.Builder
java.lang.Object
com.atlassian.jira.util.BoundedExecutorServiceWrapper.Builder
- Enclosing class:
BoundedExecutorServiceWrapper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()withConcurrency(int concurrency) Set the max number of concurrent operations supported by the ExecutorServicewithExecutorService(Supplier<com.google.common.util.concurrent.ListeningExecutorService> executorServiceSupplier) Provide a custom executor service supplier.withShutdownTimeout(org.joda.time.Duration shutdownTimeout) Set the timeout duration for shutting down the executor service.withThreadPoolName(String threadPoolName) Set the thread pool name used by the executor service that is managed by the wrapper.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withConcurrency
Set the max number of concurrent operations supported by the ExecutorService- Parameters:
concurrency- The max number of concurrent operations.- Returns:
- a configured builder.
-
withShutdownTimeout
public BoundedExecutorServiceWrapper.Builder withShutdownTimeout(@Nonnull org.joda.time.Duration shutdownTimeout) Set the timeout duration for shutting down the executor service.- Parameters:
shutdownTimeout- The timeout duration for shutting down the executor service.- Returns:
- a configured builder
-
withThreadPoolName
Set the thread pool name used by the executor service that is managed by the wrapper. This setting cannot be used withwithExecutorService(Supplier).- Parameters:
threadPoolName- The thread pool name- Returns:
- a configured builder
-
withExecutorService
public BoundedExecutorServiceWrapper.Builder withExecutorService(@Nonnull Supplier<com.google.common.util.concurrent.ListeningExecutorService> executorServiceSupplier) Provide a custom executor service supplier. This setting cannot be used with the thread pool name setting. NB A cached thread pool is recommended as the executor service.- Parameters:
executorServiceSupplier- Supplier of a suitable executor service to use- Returns:
- a builder configured with the supplier.
-
build
-