Class: Concurrent::Actor::Behaviour::SetResults
- Inherits:
-
Abstract
- Object
- Abstract
- Concurrent::Actor::Behaviour::SetResults
- Defined in:
- lib/concurrent/actor/behaviour/sets_results.rb
Overview
Collects returning value and sets the ResolvableFuture in the Envelope or error on failure.
Instance Attribute Summary (collapse)
- - (undocumented) core inherited from Abstract readonly
- - (undocumented) error_strategy readonly
- - (undocumented) subsequent inherited from Abstract readonly
Instance Method Summary (collapse)
-
- (SetResults) initialize(core, subsequent, core_options, error_strategy)
constructor
A new instance of SetResults.
- - (undocumented) on_envelope(envelope)
Constructor Details
- (SetResults) initialize(core, subsequent, core_options, error_strategy)
Returns a new instance of SetResults
8 9 10 11 |
# File 'lib/concurrent/actor/behaviour/sets_results.rb', line 8 def initialize(core, subsequent, , error_strategy) super core, subsequent, @error_strategy = Match! error_strategy, :just_log, :terminate!, :pause! end |
Instance Attribute Details
- (undocumented) core (readonly) Originally defined in class Abstract
- (undocumented) error_strategy (readonly)
6 7 8 |
# File 'lib/concurrent/actor/behaviour/sets_results.rb', line 6 def error_strategy @error_strategy end |
- (undocumented) subsequent (readonly) Originally defined in class Abstract
Instance Method Details
- (undocumented) on_envelope(envelope)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/concurrent/actor/behaviour/sets_results.rb', line 13 def on_envelope(envelope) result = pass envelope if result != MESSAGE_PROCESSED && !envelope.future.nil? envelope.future.fulfill result log(DEBUG) { "finished processing of #{envelope..inspect}"} end nil rescue => error log ERROR, error case error_strategy when :terminate! terminate! when :pause! behaviour!(Pausing).pause!(error) when :just_log # nothing else raise end envelope.future.reject error unless envelope.future.nil? end |