|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgpars.group.PGroup
abstract class PGroup
Provides a common super class of pooled actor groups.
Constructor Summary | |
protected PGroup(Pool threadPool)
Creates a group for actors, agents, tasks and operators. |
Method Summary | |
---|---|
AbstractPooledActor
|
actor(Runnable handler)
Creates a new instance of PooledActor, using the passed-in runnable/closure as the body of the actor's act() method. |
Agent
|
agent(def state)
Creates an agent instance initialized with the given state |
Agent
|
agent(def state, groovy.lang.Closure copy)
Creates an agent instance initialized with the given state |
Agent
|
fairAgent(def state)
Creates an agent instance initialized with the given state, which will cooperate in thread sharing with other Agent instances in a fair manner. |
Agent
|
fairAgent(def state, groovy.lang.Closure copy)
Creates an agent instance initialized with the given state, which will cooperate in thread sharing with other Agent instances in a fair manner. |
Pool
|
getThreadPool()
|
AbstractPooledActor
|
messageHandler(groovy.lang.Closure code)
Creates an instance of DynamicDispatchActor. |
DataFlowOperator
|
operator(Map channels, groovy.lang.Closure code)
Creates an operator using the current actor group |
AbstractPooledActor
|
reactor(groovy.lang.Closure code)
Creates a reactor around the supplied code. |
void
|
task(groovy.lang.Closure code)
Creates a new task assigned to a thread from the current actor group. |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail |
---|
protected PGroup(Pool threadPool)
Method Detail |
---|
final AbstractPooledActor actor(Runnable handler)
handler
- The body of the newly created actor's act method.
final Agent agent(def state)
state
- The initial internal state of the new Agent instance
final Agent agent(def state, groovy.lang.Closure copy)
state
- The initial internal state of the new Agent instancecopy
- A closure to use to create a copy of the internal state when sending the internal state out
final Agent fairAgent(def state)
state
- The initial internal state of the new Agent instance
final Agent fairAgent(def state, groovy.lang.Closure copy)
copy
- A closure to use to create a copy of the internal state when sending the internal state outstate
- The initial internal state of the new Agent instance
Pool getThreadPool()
final AbstractPooledActor messageHandler(groovy.lang.Closure code)
code
- The closure specifying individual message handlers.
DataFlowOperator operator(Map channels, groovy.lang.Closure code)
channels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowStream or DataFlowVariable classes) to use for inputs and outputscode
- The operator's body to run each time all inputs have a value to read
final AbstractPooledActor reactor(groovy.lang.Closure code)
The
- code to invoke for each received message
void task(groovy.lang.Closure code)
code
- The task body to run
Groovy Documentation