|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.scheduler.FJPool
public class FJPool
Represents the actors' thread pool, which performs tasks on behalf of the actors. Uses a ForkJoinPool from JSR-166y The actors' thread pool size defaults to the n + 1, where n is the number of processors/cores available on the machine. The VM parameter -Dgpars.poolsize can be used the configure the default size of the actors' thread pool. The resize() and resetDefaultSize() methods can be used to configure size of the thread pool at runtime.
Field Summary | |
---|---|
private int |
configuredPoolSize
|
private static long |
DEFAULT_SHUTDOWN_TIMEOUT
|
protected jsr166y.ForkJoinPool |
pool
|
Fields inherited from interface groovyx.gpars.scheduler.Pool |
---|
POOL_SIZE_MUST_BE_A_POSITIVE_NUMBER, UNCAUGHT_EXCEPTION_OCCURRED_IN_ACTOR_POOL |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final jsr166y.ForkJoinPool pool
private final int configuredPoolSize
private static final long DEFAULT_SHUTDOWN_TIMEOUT
Constructor Detail |
---|
public FJPool()
public FJPool(int configuredPoolSize)
configuredPoolSize
- The required size of the poolpublic FJPool(jsr166y.ForkJoinPool pool)
pool
- The ForkJoinPool instance to wrapMethod Detail |
---|
private static jsr166y.ForkJoinPool createPool(int poolSize)
poolSize
- The required pool size @return The created thread pool
public final void resize(int poolSize)
resize
in interface Pool
poolSize
- The new pool sizepublic final void resetDefaultSize()
resetDefaultSize
in interface Pool
public int getPoolSize()
getPoolSize
in interface Pool
public void execute(java.lang.Runnable task)
execute
in interface Pool
task
- The task to schedulepublic final jsr166y.ForkJoinPool getForkJoinPool()
public final void shutdown()
shutdown
in interface Pool
protected final int getConfiguredPoolSize()
|
Copyright © 2008–2010 Václav Pech. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |