Class ExecutorServiceConfigurator
- java.lang.Object
-
- org.forgerock.openam.audit.context.ExecutorServiceConfigurator
-
public class ExecutorServiceConfigurator extends Object
Exposes aspects of a wrapped ThreadPoolExecutor's configuration. {Alink ExecutorService} decorators can choose to expose instances of this class rather than breaking encapsulation of the ExecutorService that they wrap.- Since:
- 13.0.0
-
-
Constructor Summary
Constructors Constructor Description ExecutorServiceConfigurator(ThreadPoolExecutor delegate)Constructs a newExecutorServiceConfigurator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCorePoolSize()Returns the core number of threads.longgetKeepAliveTime(TimeUnit unit)Returns the thread keep-alive time.intgetMaximumPoolSize()Returns the maximum allowed number of threads.voidsetCorePoolSize(int corePoolSize)Sets the core number of threads.voidsetKeepAliveTime(long time, TimeUnit unit)Sets the time limit for which threads may remain idle before being terminated.voidsetMaximumPoolSize(int maximumPoolSize)Sets the maximum allowed number of threads.
-
-
-
Constructor Detail
-
ExecutorServiceConfigurator
public ExecutorServiceConfigurator(ThreadPoolExecutor delegate)
Constructs a newExecutorServiceConfigurator.- Parameters:
delegate- TheThreadPoolExecutorinstance.
-
-
Method Detail
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
Sets the core number of threads.- Parameters:
corePoolSize- the new core size- See Also:
ThreadPoolExecutor.setCorePoolSize(int)
-
getCorePoolSize
public int getCorePoolSize()
Returns the core number of threads.- Returns:
- the core number of threads
- See Also:
ThreadPoolExecutor.getCorePoolSize()
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
Sets the maximum allowed number of threads.- Parameters:
maximumPoolSize- the new maximum- See Also:
ThreadPoolExecutor.setMaximumPoolSize(int)
-
getMaximumPoolSize
public int getMaximumPoolSize()
Returns the maximum allowed number of threads.- Returns:
- the maximum allowed number of threads
- See Also:
ThreadPoolExecutor.getMaximumPoolSize()
-
setKeepAliveTime
public void setKeepAliveTime(long time, TimeUnit unit)Sets the time limit for which threads may remain idle before being terminated.- Parameters:
time- the time to wait. A time value of zero will cause excess threads to terminate immediately after executing tasks.unit- the time unit of thetimeargument- See Also:
ThreadPoolExecutor.setKeepAliveTime(long, TimeUnit)
-
getKeepAliveTime
public long getKeepAliveTime(TimeUnit unit)
Returns the thread keep-alive time.- Parameters:
unit- the desired time unit of the result- Returns:
- the time limit
- See Also:
ThreadPoolExecutor.getKeepAliveTime(TimeUnit)
-
-