|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgpars.group.PGroup
gpars.group.DefaultPGroup
class DefaultPGroup extends PGroup
Provides logical grouping for actors, agents and dataflow tasks and operators. Each group has an underlying thread pool, which will perform actions on behalf of the users belonging to the group. 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.actorGroup property, which defaults to the Actors.defaultActorPGroup, can be set before the actor is started.
def group = new DefaultPGroup() def actor = new MyActor() actor.actorGroup = group actor.start() ... group.shutdown()
Constructor Summary | |
DefaultPGroup(Pool threadPool)
Creates a group for actors, agents, tasks and operators. |
|
DefaultPGroup()
Creates a group for actors, agents, tasks and operators. |
|
DefaultPGroup(int poolSize)
Creates a group for actors, agents, tasks and operators. |
Method Summary |
---|
Methods inherited from class PGroup | |
---|---|
actor, agent, agent, fairAgent, fairAgent, getThreadPool, messageHandler, operator, reactor, task |
Constructor Detail |
---|
public DefaultPGroup(Pool threadPool)
public DefaultPGroup()
public DefaultPGroup(int poolSize)
Groovy Documentation