public final class DefaultPGroup extends PGroup
Actors created through the DefaultPGroup.actor method will automatically belong to the group
through which they were created, just like agents created through the agent or fairAgent
methods or dataflow tasks and operators created through the task or operator methods.
Uses a pool of non-daemon threads. The DefaultPGroup class implements the Pool interface
through @Delegate.
def group = new DefaultPGroup()
group.resize 1
def actor = group.actor {
react { message ->
println message
}
}.start()
actor.send 'Hi!'
. . .
group.shutdown()
Otherwise, if constructing Actors directly through their constructors, the AbstractPooledActor.parallelGroup property, which defaults to the Actors.defaultActorPGroup, can
be set before the actor is started.
def group = new DefaultPGroup() def actor = new MyActor() actor.parallelGroup = group actor.start() . . . group.shutdown()
A_SPLITTER_NEEDS_AN_INPUT_CHANNEL_AND_AT_LEAST_ONE_OUTPUT_CHANNEL_TO_BE_CREATED| Constructor and Description |
|---|
DefaultPGroup()
Creates a group for actors, agents, tasks and operators.
|
DefaultPGroup(int poolSize)
Creates a group for actors, agents, tasks and operators.
|
DefaultPGroup(Pool threadPool)
Creates a group for actors, agents, tasks and operators.
|
actor, agent, agent, blockingActor, execute, fairActor, fairAgent, fairAgent, fairMessageHandler, fairReactor, fairStaticMessageHandler, finalize, getPoolSize, getThreadPool, lazyTask, lazyTask, messageHandler, operator, operator, operator, operator, operator, prioritySelector, prioritySelector, prioritySelector, prioritySelector, reactor, resetDefaultSize, resize, select, select, selector, selector, selector, selector, shutdown, splitter, splitter, staticMessageHandler, task, task, task, whenAllBound, whenAllBound, whenAllBound, whenAllBound, whenAllBound, whenAllBound, whenAllBound, whenAllBound, whenAllBound, whenAllBoundpublic DefaultPGroup(Pool threadPool)
threadPool - The thread pool to use for the grouppublic DefaultPGroup()
public DefaultPGroup(int poolSize)
poolSize - The initial size of the underlying thread pool