|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.scheduler.DefaultPool
public class DefaultPool
Represents the actors' thread pool, which performs tasks on behalf of the actors. 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 |
SHUTDOWN_TIMEOUT
|
private java.util.concurrent.ThreadPoolExecutor |
pool
|
private static java.util.concurrent.atomic.AtomicLong |
threadCount
Sets the pool size to the default |
Constructor Summary | |
DefaultPool()
|
|
DefaultPool(boolean daemon)
|
|
DefaultPool(boolean daemon, int poolSize)
Creates the pool around the given executor service |
|
DefaultPool(java.util.concurrent.ThreadPoolExecutor pool)
|
Method Summary | |
---|---|
private static java.util.concurrent.ThreadPoolExecutor
|
createPool(boolean daemon, int poolSize)
|
protected static java.lang.String
|
createThreadName()
Created a JVM-unique name for Actors' threads. |
void
|
execute(java.lang.Runnable task)
Retrieves the internal executor service. |
java.util.concurrent.ExecutorService
|
getExecutorService()
|
int
|
getPoolSize()
schedules a new task for processing with the pool |
void
|
resetDefaultSize()
|
void
|
resize(int poolSize)
|
void
|
shutdown()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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 SHUTDOWN_TIMEOUT
private final java.util.concurrent.ThreadPoolExecutor pool
private static final java.util.concurrent.atomic.AtomicLong threadCount
Constructor Detail |
---|
public DefaultPool()
public DefaultPool(boolean daemon)
public DefaultPool(boolean daemon, int poolSize)
pool
- The executor service to use
public DefaultPool(java.util.concurrent.ThreadPoolExecutor pool)
Method Detail |
---|
private static java.util.concurrent.ThreadPoolExecutor createPool(boolean daemon, int poolSize)
protected static java.lang.String createThreadName()
@java.lang.Override* Gently stops the pool public final void execute(java.lang.Runnable task)
public final java.util.concurrent.ExecutorService getExecutorService()
@java.lang.Override/** public int getPoolSize()
task
- The task to schedule
@java.lang.Override/** public final void resetDefaultSize()
@java.lang.Override* Retrieves the current thread pool size public final void resize(int poolSize)
@java.lang.Override public final void shutdown()
Copyright © 2008–2013 Václav Pech. All Rights Reserved.