com.atlassian.jira.util
Class BoundedExecutorServiceWrapper.Builder

java.lang.Object
  extended by com.atlassian.jira.util.BoundedExecutorServiceWrapper.Builder
Enclosing class:
BoundedExecutorServiceWrapper

public static class BoundedExecutorServiceWrapper.Builder
extends Object


Constructor Summary
BoundedExecutorServiceWrapper.Builder()
           
 
Method Summary
 BoundedExecutorServiceWrapper build()
           
 BoundedExecutorServiceWrapper.Builder withConcurrency(int concurrency)
          Set the max number of concurrent operations supported by the ExecutorService
 BoundedExecutorServiceWrapper.Builder withExecutorService(Supplier<com.google.common.util.concurrent.ListeningExecutorService> executorServiceSupplier)
          Provide a custom executor service supplier.
 BoundedExecutorServiceWrapper.Builder withShutdownTimeout(org.joda.time.Duration shutdownTimeout)
          Set the timeout duration for shutting down the executor service.
 BoundedExecutorServiceWrapper.Builder withThreadPoolName(String threadPoolName)
          Set the thread pool name used by the executor service that is managed by the wrapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedExecutorServiceWrapper.Builder

public BoundedExecutorServiceWrapper.Builder()
Method Detail

withConcurrency

public BoundedExecutorServiceWrapper.Builder withConcurrency(int concurrency)
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

public BoundedExecutorServiceWrapper.Builder withThreadPoolName(@Nonnull
                                                                String threadPoolName)
Set the thread pool name used by the executor service that is managed by the wrapper. This setting cannot be used with withExecutorService(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

public BoundedExecutorServiceWrapper build()


Copyright © 2002-2014 Atlassian. All Rights Reserved.