Groovy Documentation

gpars.scheduler
Class DefaultPool

java.lang.Object
  gpars.scheduler.DefaultPool
All Implemented Interfaces:
Pool

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.

author:
Vaclav Pech Date: Feb 27, 2009


Constructor Summary
DefaultPool()

Creates the pool with default number of daemon threads.

DefaultPool(boolean daemon)

Creates the pool with default number of threads.

DefaultPool(boolean daemon, int poolSize)

Creates the pool with specified number of threads.

DefaultPool(ThreadPoolExecutor pool)

Creates the pool around the given executor service

 
Method Summary
protected static String createThreadName()

Created a JVM-unique name for Actors' threads.

void execute(Runnable task)

schedules a new task for processing with the pool

ExecutorService getExecutorService()

Retrieves the internal executor service.

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 Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

DefaultPool

public DefaultPool()
Creates the pool with default number of daemon threads.


DefaultPool

public DefaultPool(boolean daemon)
Creates the pool with default number of threads.
param:
daemon Sets the daemon flag of threads in the pool.


DefaultPool

public DefaultPool(boolean daemon, int poolSize)
Creates the pool with specified number of threads.
param:
daemon Sets the daemon flag of threads in the pool.
param:
poolSize The required size of the pool


DefaultPool

public DefaultPool(ThreadPoolExecutor pool)
Creates the pool around the given executor service
param:
pool The executor service to use


 
Method Detail

createThreadName

protected static String createThreadName()
Created a JVM-unique name for Actors' threads.
return:
The name prefix


execute

public final void execute(Runnable task)
schedules a new task for processing with the pool
param:
task The task to schedule


getExecutorService

public final ExecutorService getExecutorService()
Retrieves the internal executor service.
return:
The underlying thread pool


resetDefaultSize

public final void resetDefaultSize()
Sets the pool size to the default


resize

public final void resize(int poolSize)
Resizes the thread pool to the specified value
param:
poolSize The new pool size


shutdown

public final void shutdown()
Gently stops the pool


 

Groovy Documentation