public class FJPool extends java.lang.Object implements Pool
Modifier and Type | Field and Description |
---|---|
private int |
configuredPoolSize |
private static long |
DEFAULT_SHUTDOWN_TIMEOUT |
protected jsr166y.ForkJoinPool |
pool |
POOL_SIZE_MUST_BE_A_POSITIVE_NUMBER, UNCAUGHT_EXCEPTION_OCCURRED_IN_GPARS_POOL
Constructor and Description |
---|
FJPool()
Creates the pool with default number of threads.
|
FJPool(jsr166y.ForkJoinPool pool)
Creates the pool wrapping the provided ForkJoinPool
|
FJPool(int configuredPoolSize)
Creates the pool with specified number of threads.
|
Modifier and Type | Method and Description |
---|---|
private static jsr166y.ForkJoinPool |
createPool(int poolSize)
Creates a fork/join pool of given size.
|
void |
execute(java.lang.Runnable task)
schedules a new task for processing with the pool
|
protected int |
getConfiguredPoolSize() |
jsr166y.ForkJoinPool |
getForkJoinPool()
Retrieves the internal executor service.
|
int |
getPoolSize()
Retrieves the current thread pool size
|
void |
resetDefaultSize()
Sets the pool size to the default
|
void |
resize(int poolSize)
Resizes the thread pool to the specified value
|
void |
shutdown()
Gently stops the pool
|
protected final jsr166y.ForkJoinPool pool
private final int configuredPoolSize
private static final long DEFAULT_SHUTDOWN_TIMEOUT
public FJPool()
public FJPool(int configuredPoolSize)
configuredPoolSize
- The required size of the poolpublic FJPool(jsr166y.ForkJoinPool pool)
pool
- The ForkJoinPool instance to wrapprivate static jsr166y.ForkJoinPool createPool(int poolSize)
poolSize
- The required pool size @return The created thread poolpublic final void resize(int poolSize)
public final void resetDefaultSize()
resetDefaultSize
in interface Pool
public int getPoolSize()
getPoolSize
in interface Pool
public void execute(java.lang.Runnable task)
public final jsr166y.ForkJoinPool getForkJoinPool()
public final void shutdown()
protected final int getConfiguredPoolSize()