|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.group.PGroup
abstract class PGroup extends java.lang.Object
Provides a common super class of pooled parallel groups.
Field 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 DefaultActor, 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 |
BlockingActor
|
blockingActor(java.lang.Runnable handler)
Creates a new instance of BlockingActor, using the passed-in closure as the body of the actor's act() method. |
DefaultActor
|
fairActor(java.lang.Runnable handler)
Creates a new instance of DefaultActor, 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. |
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() |
Field Detail |
---|
@Delegate private Pool threadPool
Constructor Detail |
---|
protected PGroup(Pool threadPool)
Method Detail |
---|
final DefaultActor actor(java.lang.Runnable handler)
handler
- The body of the newly created actor's act method.
final Agent agent(T state)
state
- The initial internal state of the new Agent instance
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
final BlockingActor blockingActor(java.lang.Runnable handler)
handler
- The body of the newly created actor's act method.
final DefaultActor fairActor(java.lang.Runnable handler)
handler
- The body of the newly created actor's act method.
final Agent fairAgent(T state)
state
- The initial internal state of the new Agent instance
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
final Actor fairMessageHandler(groovy.lang.Closure code)
code
- The closure specifying individual message handlers.
final Actor fairReactor(groovy.lang.Closure code)
The
- code to invoke for each received message
protected void finalize()
Pool getThreadPool()
final Actor messageHandler(groovy.lang.Closure code)
code
- The closure specifying individual message handlers.
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
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
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
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
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
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
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
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
DataflowProcessor prioritySelector(java.util.List inputChannels, java.util.List outputChannels)
inputChannels
- dataflow channels to use for inputoutputChannels
- dataflow channels to use for output
final Actor reactor(groovy.lang.Closure code)
The
- code to invoke for each received message
Select select(DataflowReadChannel channels)
channels
- Dataflow variables or streams to wait for values on
Select select(java.util.List channels)
channels
- Dataflow variables or streams to wait for values on
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
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
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
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
DataflowProcessor splitter(DataflowReadChannel inputChannel, java.util.List outputChannels)
inputChannel
- The channel to read values fromoutputChannels
- A list of channels to output to
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
DataflowVariable task(groovy.lang.Closure code)
code
- The task body to run
DataflowVariable task(java.util.concurrent.Callable callable)
callable
- The task body to run
DataflowVariable task(java.lang.Runnable code)
code
- The task body to run
Copyright © 2008–2010 Václav Pech. All Rights Reserved.