-
public class ExecutorFactoryHelper class which contains functions to create pre-configured executors
-
-
Method Summary
Modifier and Type Method Description static ScheduledExecutorServicecreateSingleThreadScheduledExecutor(String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)Create ScheduledExecutorService with single executor thread static ScheduledExecutorServicecreateCPUBoundScheduledExecutor(String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)Create ScheduledExecutorService with number of threads up tonumber of CPU cores on machine static ExecutorServicecreateFixedThreadPool(int threadsLimit, String threadNamePrefix)Creates a ExecutorService with limited number of threads whichare released after idle timeout. static ExecutorServicecreateCachedThreadPool(String threadNamePrefix)Creates an ExecutorService with an unlimited number of threadswhich are released after idle timeout. -
-
Method Detail
-
createSingleThreadScheduledExecutor
static ScheduledExecutorService createSingleThreadScheduledExecutor(String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)
Create ScheduledExecutorService with single executor thread
- Parameters:
threadNamePrefix- - name prefix for threads created by poolthreadKeepAliveTime- - keep alive time before idle thread is freedtimeUnit- - time unit of threadKeepAliveTime
-
createCPUBoundScheduledExecutor
static ScheduledExecutorService createCPUBoundScheduledExecutor(String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)
Create ScheduledExecutorService with number of threads up tonumber of CPU cores on machine
- Parameters:
threadNamePrefix- - name prefix for threads created by poolthreadKeepAliveTime- - keep alive time before idle thread is freedtimeUnit- - time unit of threadKeepAliveTime
-
createFixedThreadPool
static ExecutorService createFixedThreadPool(int threadsLimit, String threadNamePrefix)
Creates a ExecutorService with limited number of threads whichare released after idle timeout.
- Parameters:
threadsLimit- - numbers of threads in poolthreadNamePrefix- - name prefix for threads created by pool
-
createCachedThreadPool
static ExecutorService createCachedThreadPool(String threadNamePrefix)
Creates an ExecutorService with an unlimited number of threadswhich are released after idle timeout.
- Parameters:
threadNamePrefix- - name prefix for threads created by pool
-
-
-
-