|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectgroovyx.gpars.group.PGroup
class PGroup
Provides a common super class of pooled parallel groups.
Property Summary | |
---|---|
private Pool |
threadPool
Stores the group actors' thread pool |
Constructor Summary | |
protected PGroup(Pool threadPool)
Creates a group for actors, agents, tasks and operators. |
Method Summary | |
---|---|
DefaultActor
|
actor(java.lang.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(T state)
Creates an agent instance initialized with the given state |
Agent
|
agent(T state, groovy.lang.Closure copy)
Creates an agent instance initialized with the given state |
DefaultActor
|
fairActor(java.lang.Runnable handler)
Creates a new instance of PooledActor, using the passed-in runnable/closure as the body of the actor's act() method. |
Agent
|
fairAgent(T state)
Creates an agent instance initialized with the given state, which will cooperate in thread sharing with other agents and actors in a fair manner. |
Agent
|
fairAgent(T state, groovy.lang.Closure copy)
Creates an agent instance initialized with the given state, which will cooperate in thread sharing with other agents and actors in a fair manner. |
Actor
|
fairMessageHandler(groovy.lang.Closure code)
Creates an instance of DynamicDispatchActor, which will cooperate in thread sharing with other actors sharing the same thread pool |
Actor
|
fairReactor(groovy.lang.Closure code)
Creates a reactor around the supplied code, which will cooperate in thread sharing with other actors sharing the same thread pool When a reactor receives a message, the supplied block of code is run with the message as a parameter and the result of the code is send in reply. |
protected void
|
finalize()
Shutdown the thread pool gracefully |
Pool
|
getThreadPool()
|
Actor
|
messageHandler(groovy.lang.Closure code)
Creates an instance of DynamicDispatchActor. |
AbstractPooledActor
|
oldActor(java.lang.Runnable handler)
|
DataFlowProcessor
|
operator(java.util.Map channels, groovy.lang.Closure code)
Creates an operator using the current parallel group |
DataFlowProcessor
|
operator(java.util.List inputChannels, java.util.List outputChannels, groovy.lang.Closure code)
Creates an operator using the current parallel group |
DataFlowProcessor
|
operator(java.util.List inputChannels, java.util.List outputChannels, int maxForks, groovy.lang.Closure code)
Creates an operator using the current parallel group |
DataFlowProcessor
|
operator(DataFlowReadChannel input, DataFlowWriteChannel output, groovy.lang.Closure code)
Creates an operator using the current parallel group |
DataFlowProcessor
|
operator(DataFlowReadChannel input, DataFlowWriteChannel output, int maxForks, groovy.lang.Closure code)
Creates an operator using the current parallel group |
DataFlowProcessor
|
prioritySelector(java.util.Map channels, groovy.lang.Closure code)
Creates a prioritizing selector using the default dataflow parallel group Input with lower position index have higher priority. |
DataFlowProcessor
|
prioritySelector(java.util.List inputChannels, java.util.List outputChannels, groovy.lang.Closure code)
Creates a prioritizing selector using the default dataflow parallel group Input with lower position index have higher priority. |
DataFlowProcessor
|
prioritySelector(java.util.Map channels)
Creates a prioritizing selector using the default dataflow parallel group. |
DataFlowProcessor
|
prioritySelector(java.util.List inputChannels, java.util.List outputChannels)
Creates a prioritizing selector using the default dataflow parallel group. |
Actor
|
reactor(groovy.lang.Closure code)
Creates a reactor around the supplied code. |
Select
|
select(DataFlowReadChannel channels)
Creates a select using the current parallel group. |
Select
|
select(java.util.List channels)
Creates a select using the current parallel group. |
DataFlowProcessor
|
selector(java.util.Map channels, groovy.lang.Closure code)
Creates a selector using this parallel group |
DataFlowProcessor
|
selector(java.util.List inputChannels, java.util.List outputChannels, groovy.lang.Closure code)
Creates a selector using this parallel group |
DataFlowProcessor
|
selector(java.util.Map channels)
Creates a selector using this parallel group. |
DataFlowProcessor
|
selector(java.util.List inputChannels, java.util.List outputChannels)
Creates a selector using this parallel group. |
DataFlowProcessor
|
splitter(DataFlowReadChannel inputChannel, java.util.List outputChannels)
Creates a splitter copying its single input channel into all of its output channels. |
DataFlowProcessor
|
splitter(DataFlowReadChannel inputChannel, java.util.List outputChannels, int maxForks)
Creates a splitter copying its single input channel into all of its output channels. |
DataFlowVariable
|
task(groovy.lang.Closure code)
Creates a new task assigned to a thread from the current parallel group. |
DataFlowVariable
|
task(java.util.concurrent.Callable callable)
Creates a new task assigned to a thread from the current parallel group. |
DataFlowVariable
|
task(java.lang.Runnable code)
Creates a new task assigned to a thread from the current parallel group. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Property Detail |
---|
@Delegate private Pool threadPool
Constructor Detail |
---|
protected PGroup(Pool threadPool)
Method Detail |
---|
public final DefaultActor actor(java.lang.Runnable handler)
handler
- The body of the newly created actor's act method.
public final Agent agent(T state)
state
- The initial internal state of the new Agent instance
public final Agent agent(T 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
public final DefaultActor fairActor(java.lang.Runnable handler)
handler
- The body of the newly created actor's act method.
public final Agent fairAgent(T state)
state
- The initial internal state of the new Agent instance
public final Agent fairAgent(T 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
public final Actor fairMessageHandler(groovy.lang.Closure code)
code
- The closure specifying individual message handlers.
public final Actor fairReactor(groovy.lang.Closure code)
The
- code to invoke for each received message
protected void finalize()
public Pool getThreadPool()
public final Actor messageHandler(groovy.lang.Closure code)
code
- The closure specifying individual message handlers.
@Deprecated public final AbstractPooledActor oldActor(java.lang.Runnable handler)
public DataFlowProcessor operator(java.util.Map channels, groovy.lang.Closure code)
channels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowQueue or DataFlowVariable classes) to use for inputs and outputscode
- The operator's body to run each time all inputs have a value to read
public DataFlowProcessor operator(java.util.List inputChannels, java.util.List outputChannels, groovy.lang.Closure code)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for outputcode
- The operator's body to run each time all inputs have a value to read
public DataFlowProcessor operator(java.util.List inputChannels, java.util.List outputChannels, int maxForks, groovy.lang.Closure code)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for outputmaxForks
- Number of parallel threads running operator's body, defaults to 1code
- The operator's body to run each time all inputs have a value to read
public DataFlowProcessor operator(DataFlowReadChannel input, DataFlowWriteChannel output, groovy.lang.Closure code)
input
- a dataflow channel to use for inputoutput
- a dataflow channel to use for outputcode
- The operator's body to run each time all inputs have a value to read
public DataFlowProcessor operator(DataFlowReadChannel input, DataFlowWriteChannel output, int maxForks, groovy.lang.Closure code)
input
- a dataflow channel to use for inputoutput
- a dataflow channel to use for outputmaxForks
- Number of parallel threads running operator's body, defaults to 1code
- The operator's body to run each time all inputs have a value to read
public DataFlowProcessor prioritySelector(java.util.Map channels, groovy.lang.Closure code)
channels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowQueue or DataFlowVariable classes) to use for inputs and outputscode
- The selector's body to run each time a value is available in any of the inputs channels
public DataFlowProcessor prioritySelector(java.util.List inputChannels, java.util.List outputChannels, groovy.lang.Closure code)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for outputcode
- The selector's body to run each time a value is available in any of the inputs channels
public DataFlowProcessor prioritySelector(java.util.Map channels)
channels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowQueue or DataFlowVariable classes) to use for inputs and outputs
public DataFlowProcessor prioritySelector(java.util.List inputChannels, java.util.List outputChannels)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for output
public final Actor reactor(groovy.lang.Closure code)
The
- code to invoke for each received message
public Select select(DataFlowReadChannel channels)
channels
- Dataflow variables or streams to wait for values on
public Select select(java.util.List channels)
channels
- Dataflow variables or streams to wait for values on
public DataFlowProcessor selector(java.util.Map channels, groovy.lang.Closure code)
channels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowQueue or DataFlowVariable classes) to use for inputs and outputscode
- The selector's body to run each time a value is available in any of the inputs channels
public DataFlowProcessor selector(java.util.List inputChannels, java.util.List outputChannels, groovy.lang.Closure code)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for outputcode
- The selector's body to run each time a value is available in any of the inputs channels
public DataFlowProcessor selector(java.util.Map channels)
channels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowQueue or DataFlowVariable classes) to use for inputs and outputscode
- The selector's body to run each time a value is available in any of the inputs channels
public DataFlowProcessor selector(java.util.List inputChannels, java.util.List outputChannels)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for outputcode
- The selector's body to run each time a value is available in any of the inputs channels
public DataFlowProcessor splitter(DataFlowReadChannel inputChannel, java.util.List outputChannels)
inputChannel
- The channel to read values fromoutputChannels
- A list of channels to output to
public DataFlowProcessor splitter(DataFlowReadChannel inputChannel, java.util.List outputChannels, int maxForks)
inputChannel
- The channel to read values fromoutputChannels
- A list of channels to output tomaxForks
- Number of threads running the splitter's body, defaults to 1
public DataFlowVariable task(groovy.lang.Closure code)
code
- The task body to run
public DataFlowVariable task(java.util.concurrent.Callable callable)
callable
- The task body to run
public DataFlowVariable task(java.lang.Runnable code)
code
- The task body to run
Copyright © 2008–2010 Václav Pech. All Rights Reserved.