Groovy Documentation

gpars.scheduler
Class FJPool

java.lang.Object
  gpars.scheduler.FJPool
All Implemented Interfaces:
jsr166y.forkjoin.ForkJoinPool

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.

author:
Vaclav Pech Date: Feb 27, 2009


Field Summary
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.

 
Method Summary
void execute(Runnable task)

schedules a new task for processing with the pool

protected int getConfiguredPoolSize()

ForkJoinPool getForkJoinPool()

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
 

Field Detail

pool

protected ForkJoinPool pool


 
Constructor Detail

FJPool

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


FJPool

public FJPool(int configuredPoolSize)
Creates the pool with specified number of threads.
param:
configuredPoolSize The required size of the pool


 
Method Detail

execute

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


getConfiguredPoolSize

protected final int getConfiguredPoolSize()


getForkJoinPool

public final ForkJoinPool getForkJoinPool()
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