Class: Subserver::Launcher
- Inherits:
-
Object
- Object
- Subserver::Launcher
- Includes:
- Util
- Defined in:
- lib/subserver/launcher.rb
Overview
The Launcher is a very simple Actor whose job is to start, monitor and stop the core Actors in Subserver. If any of these actors die, the Subserver process exits immediately.
Constant Summary
Constants included from Util
Instance Attribute Summary collapse
-
#manager ⇒ Object
Returns the value of attribute manager.
Instance Method Summary collapse
-
#initialize(options) ⇒ Launcher
constructor
A new instance of Launcher.
-
#quiet ⇒ Object
Stops this instance from processing any more jobs,.
- #run ⇒ Object
-
#stop ⇒ Object
Shuts down the process.
- #stopping? ⇒ Boolean
- #to_data ⇒ Object
- #to_json ⇒ Object
Methods included from Util
#fire_event, #hostname, #identity, #logger, #process_nonce, #safe_thread, #watchdog
Methods included from ExceptionHandler
Constructor Details
Instance Attribute Details
#manager ⇒ Object
Returns the value of attribute manager.
12 13 14 |
# File 'lib/subserver/launcher.rb', line 12 def manager @manager end |
Instance Method Details
#quiet ⇒ Object
Stops this instance from processing any more jobs,
26 27 28 29 |
# File 'lib/subserver/launcher.rb', line 26 def quiet @done = true @manager.quiet end |
#run ⇒ Object
20 21 22 |
# File 'lib/subserver/launcher.rb', line 20 def run @manager.start end |
#stop ⇒ Object
Shuts down the process. This method does not return until all work is complete and cleaned up. It can take up to the timeout to complete.
34 35 36 37 38 39 40 |
# File 'lib/subserver/launcher.rb', line 34 def stop deadline = Time.now + @options[:timeout] @done = true @manager.quiet @manager.stop(deadline) end |
#stopping? ⇒ Boolean
42 43 44 |
# File 'lib/subserver/launcher.rb', line 42 def stopping? @done end |
#to_data ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/subserver/launcher.rb', line 48 def to_data @data ||= begin { 'hostname' => hostname, 'started_at' => Time.now.to_f, 'pid' => $$, 'tag' => @options[:tag] || '', 'queues' => @options[:queues].uniq, 'labels' => @options[:labels], 'identity' => identity, } end end |