Class: Shoryuken::Launcher
- Inherits:
-
Object
- Object
- Shoryuken::Launcher
- Includes:
- Celluloid, Util
- Defined in:
- lib/shoryuken/launcher.rb
Instance Attribute Summary collapse
-
#manager ⇒ Object
Returns the value of attribute manager.
Instance Method Summary collapse
- #actor_died(actor, reason) ⇒ Object
-
#initialize ⇒ Launcher
constructor
A new instance of Launcher.
- #run ⇒ Object
- #stop(options = {}) ⇒ Object
Methods included from Util
#elapsed, #fire_event, #logger, #unparse_queues, #watchdog, #worker_name
Constructor Details
#initialize ⇒ Launcher
Returns a new instance of Launcher.
10 11 12 13 14 15 16 17 18 |
# File 'lib/shoryuken/launcher.rb', line 10 def initialize @condvar = Celluloid::Condition.new @manager = Shoryuken::Manager.new_link(@condvar) @fetcher = Shoryuken::Fetcher.new_link(manager) @done = false manager.fetcher = @fetcher end |
Instance Attribute Details
#manager ⇒ Object
Returns the value of attribute manager.
8 9 10 |
# File 'lib/shoryuken/launcher.rb', line 8 def manager @manager end |
Instance Method Details
#actor_died(actor, reason) ⇒ Object
37 38 39 40 41 |
# File 'lib/shoryuken/launcher.rb', line 37 def actor_died(actor, reason) return if @done logger.warn { "Shoryuken died due to the following error, cannot recover, process exiting: #{reason}" } exit 1 end |
#run ⇒ Object
31 32 33 34 35 |
# File 'lib/shoryuken/launcher.rb', line 31 def run watchdog('Launcher#run') do manager.async.start end end |
#stop(options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/shoryuken/launcher.rb', line 20 def stop( = {}) watchdog('Launcher#stop') do @done = true @fetcher.terminate if @fetcher.alive? manager.async.stop(shutdown: !![:shutdown], timeout: Shoryuken.[:timeout]) @condvar.wait manager.terminate end end |