| Class | Dramatis::Actor::Interface |
| In: |
lib/dramatis/actor/interface.rb
|
| Parent: | Object |
This object should only be accessed from the actor it represents.
Enables the actor to run tasks that match pattern_args. Note that subsequent gate calls may override this behavior.
# File lib/dramatis/actor/interface.rb, line 47
47: def accept *args
48: @actor.gate.accept( :object, *args )
49: end
Causes tasks matching pattern_args to always be accepted if value is true or reject if value is false. always takes precendence over refuse/accept so a task that matches both a refuse pattern and an always( …, true ) pattern will be allowed. always also overrides the implict gating in rpc method calls.
# File lib/dramatis/actor/interface.rb, line 71
71: def always args, value
72: @actor.gate.always( ( [ :object ] + Array( args ) ), value )
73: end
Enables call threading for actor method calls made by this actor. When call threading is enabled, method gating is modified such that recursive and co-recursive calls are allowed. Normally blocking calls made by an actor on itself, e.g.,
actor.name.some_method
would cause a deadlock. When call threading is enabled, recursion, both self-recursion and co-recursion (actor A does an rpc on actor B which does an rpc on actor A), is allowed.
# File lib/dramatis/actor/interface.rb, line 86
86: def enable_call_threading
87: @actor.enable_call_threading
88: nil
89: end
Blocks the actor from running any tasks that match pattern_args. Note that subsequent gate calls may override this behavior.
# File lib/dramatis/actor/interface.rb, line 37
37: def refuse *args
38: @actor.gate.refuse( :object, *args )
39: end
Yields the actor to allow other tasks to be executed. Currently, messages are handled FIFO so the yield will return when all the messages received up to the point of the yield are executed. This could be modified if non-FIFO queue processing is added
# File lib/dramatis/actor/interface.rb, line 109
109: def yield
110: @actor.actor_send [ :yield ], :continuation => :rpc,
111: :nonblocking => true
112: nil
113: end