Adds a listener interested in state updates
A listener should be a closure accepting the old and the new value in this order plus optionally the agent reference as the first argument.
Adds a validator checking the agent's state
A listener should be a closure accepting the old and the new value in this order plus optionally the agent reference as the first argument.
AFTER_START -
Static variable in class groovyx.gpars.actor.Actor
If the passed-in closure expects two arguments, it is considered to be a map-iterative code and is then wrapped
with a single-argument closure, which unwraps the key:value pairs for the original closure.
If the passed-in closure expects three arguments, it is considered to be a map-iterative_with_index code and is then wrapped
with a two-argument closure, which unwraps the key:value pairs for the original closure.
A helper class enabling the 'whenBound()' or 'getValAsync' functionality of a DataFlowVariable and DataFlowQueue,
as well as 'sendAndContinue()' on actors.
Since DataFlowVariables should be only read once, they need to be disabled after selecting their value
The array stores a boolean flag for each index, indicating, whether the channel/variable has been disabled
Extends ReentrantReadWriteLock with handy withReadLock(Closure) and withWriteLock(Closure) methods to safely lock
and unlock the lock for the passed-in closure.
The idea is following:
- we try to putIfAbsent dummy DFV in to map
- if something real already there we are done
- if not we obtain lock and put new DFV with double check
Unfortunately we have to sync on this as there is no better option (God forbid to sync on name)
Retrieves the actor's fairness flag
Fair actors give up the thread after processing each message, non-fair actors keep a thread until their message queue is empty.
Retrieves the agent's fairness flag
Fair agents give up the thread after processing each message, non-fair agents keep a thread until their message queue is empty.
Retrieves the agent's fairness flag
Fair agents give up the thread after processing each message, non-fair agents keep a thread until their message queue is empty.
Schedule closure to be executed by pooled actor after data became available
It is important to notice that even if data already available the execution of closure
will not happen immediately but will be scheduled
Schedule closure to be executed by pooled actor after data became available
It is important to notice that even if data already available the execution of closure
will not happen immediately but will be scheduled
Schedule closure to be executed by pooled actor after data became available
It is important to notice that even if data already available the execution of closure
will not happen immediately but will be scheduled
Prototype of self-regulated thread pooled scheduler
Self regulation happened according to following rules
- worker thread, which had nothing to do 10 seconds dies
- if no tasks were taken for processing during last 0.5sec new worker starts
Invokes the internal select base with a SelectRequest instance ensuring the current thread can continue returning the correct value, once a value has been selected
A closure registered with all the input channels on the wheneverBound() event to inform the Select
about a value being available in a particular channel.
Schedule closure to be executed by pooled actor after data becomes available
It is important to notice that even if data already available the execution of closure
will not happen immediately but will be scheduled.
Schedule closure to be executed by pooled actor after the next data becomes available
It is important to notice that even if data already available the execution of closure
will not happen immediately but will be scheduled.
Schedule closure to be executed by pooled actor after data becomes available
It is important to notice that even if data already available the execution of closure
will not happen immediately but will be scheduled.