|
org.codehaus.gpars | |||||||
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 static long |
DEFAULT_SHUTDOWN_TIMEOUT
|
private int |
configuredPoolSize
|
protected ForkJoinPool |
pool
|
Constructor Summary | |
FJPool()
Creates the pool with default number of threads. |
|
FJPool(int configuredPoolSize)
Creates the pool with specified number of threads. |
|
FJPool(ForkJoinPool pool)
Creates the pool wrapping the provided ForkJoinPool |
Method Summary | |
---|---|
private static 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()
|
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 | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
private static final long DEFAULT_SHUTDOWN_TIMEOUT
private final int configuredPoolSize
protected final ForkJoinPool pool
Constructor Detail |
---|
public FJPool()
public FJPool(int configuredPoolSize)
configuredPoolSize
- The required size of the pool
public FJPool(ForkJoinPool pool)
pool
- The ForkJoinPool instance to wrap
Method Detail |
---|
private static ForkJoinPool createPool(int poolSize)
poolSize
- The required pool size
@Override public void execute(java.lang.Runnable task)
task
- The task to schedule
protected final int getConfiguredPoolSize()
public final ForkJoinPool getForkJoinPool()
@Override public int getPoolSize()
@Override public final void resetDefaultSize()
@Override public final void resize(int poolSize)
poolSize
- The new pool size
@Override public final void shutdown()
Copyright © 2008–2012 Václav Pech. All Rights Reserved.