Class: Concurrent::Actor::Behaviour::Supervising
- Inherits:
-
Abstract
- Object
- Abstract
- Concurrent::Actor::Behaviour::Supervising
- Defined in:
- lib/concurrent/actor/behaviour/supervising.rb
Overview
Note:
TODO missing example
Note:
this will change in next version to support supervision trees better
Handles supervised actors. Handle configures what to do with failed child: :terminate!, :resume!, :reset!, or :restart!. Strategy sets :one_for_one (restarts just failed actor) or :one_for_all (restarts all child actors).
Instance Attribute Summary (collapse)
- - (undocumented) core inherited from Abstract readonly
- - (undocumented) subsequent inherited from Abstract readonly
Instance Method Summary (collapse)
-
- (Supervising) initialize(core, subsequent, core_options, handle, strategy)
constructor
A new instance of Supervising.
- - (undocumented) on_envelope(envelope)
Constructor Details
- (Supervising) initialize(core, subsequent, core_options, handle, strategy)
Returns a new instance of Supervising
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/concurrent/actor/behaviour/supervising.rb', line 10 def initialize(core, subsequent, , handle, strategy) super core, subsequent, @handle = Match! handle, :terminate!, :resume!, :reset!, :restart! @strategy = case @handle when :terminate! Match! strategy, nil when :resume! Match! strategy, :one_for_one when :reset!, :restart! Match! strategy, :one_for_one, :one_for_all end end |
Instance Attribute Details
- (undocumented) core (readonly) Originally defined in class Abstract
- (undocumented) subsequent (readonly) Originally defined in class Abstract
Instance Method Details
- (undocumented) on_envelope(envelope)
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/concurrent/actor/behaviour/supervising.rb', line 23 def on_envelope(envelope) case envelope. when Exception, :paused receivers = if @strategy == :one_for_all children else [envelope.sender] end receivers.each { |ch| ch << @handle } else pass envelope end end |