public class ExecutorFactory extends Object
Constructor and Description |
---|
ExecutorFactory() |
Modifier and Type | Method and Description |
---|---|
static ScheduledExecutorService |
createCPUBoundScheduledExecutor(String threadNamePrefix,
int threadKeepAliveTime,
TimeUnit timeUnit)
Create
ScheduledExecutorService with number of threads up to
number of CPU cores on machine |
static ExecutorService |
createFixedThreadPool(int threadsLimit,
String threadNamePrefix)
Creates a
ExecutorService with limited number of threads which
are released after idle timeout. |
private static ScheduledExecutorService |
createScheduledExecutor(int poolSize,
String threadNamePrefix,
int threadKeepAliveTime,
TimeUnit timeUnit)
Creates pre-configured
ScheduledExecutorService instance with
defaults suitable for ice4j |
static ScheduledExecutorService |
createSingleThreadScheduledExecutor(String threadNamePrefix,
int threadKeepAliveTime,
TimeUnit timeUnit)
Create
ScheduledExecutorService with single executor thread |
public static ScheduledExecutorService createSingleThreadScheduledExecutor(String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)
ScheduledExecutorService
with single executor threadthreadNamePrefix
- - name prefix for threads created by poolthreadKeepAliveTime
- - keep alive time before idle thread is freedtimeUnit
- - time unit of threadKeepAliveTimeScheduledExecutorService
public static ScheduledExecutorService createCPUBoundScheduledExecutor(String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)
ScheduledExecutorService
with number of threads up to
number of CPU cores on machinethreadNamePrefix
- - name prefix for threads created by poolthreadKeepAliveTime
- - keep alive time before idle thread is freedtimeUnit
- - time unit of threadKeepAliveTimeScheduledExecutorService
private static ScheduledExecutorService createScheduledExecutor(int poolSize, String threadNamePrefix, int threadKeepAliveTime, TimeUnit timeUnit)
ScheduledExecutorService
instance with
defaults suitable for ice4jthreadNamePrefix
- - name prefix for threads created by poolpoolSize
- - max number of threads to keep in pool.threadKeepAliveTime
- - keep alive time before idle thread is freedtimeUnit
- - time unit of threadKeepAliveTimeScheduledExecutorService
public static ExecutorService createFixedThreadPool(int threadsLimit, String threadNamePrefix)
ExecutorService
with limited number of threads which
are released after idle timeout.threadsLimit
- - numbers of threads in poolthreadNamePrefix
- - name prefix for threads created by poolExecutorService
Copyright © 2018. All rights reserved.