Class: Droonga::ProcessSupervisor
- Inherits:
-
Object
- Object
- Droonga::ProcessSupervisor
- Includes:
- Deferrable, Loggable, ProcessControlProtocol
- Defined in:
- lib/droonga/process_supervisor.rb
Instance Attribute Summary collapse
-
#on_finish ⇒ Object
writeonly
Sets the attribute on_finish.
Instance Method Summary collapse
-
#initialize(loop, input, output) ⇒ ProcessSupervisor
constructor
A new instance of ProcessSupervisor.
- #refresh_node_reference ⇒ Object
- #refresh_self_reference ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #stop_gracefully ⇒ Object
- #stop_immediately ⇒ Object
Methods included from Deferrable
Constructor Details
#initialize(loop, input, output) ⇒ ProcessSupervisor
Returns a new instance of ProcessSupervisor.
31 32 33 34 35 |
# File 'lib/droonga/process_supervisor.rb', line 31 def initialize(loop, input, output) @loop = loop @input = create_input(input) @output = create_output(output) end |
Instance Attribute Details
#on_finish=(value) ⇒ Object
Sets the attribute on_finish
29 30 31 |
# File 'lib/droonga/process_supervisor.rb', line 29 def on_finish=(value) @on_finish = value end |
Instance Method Details
#refresh_node_reference ⇒ Object
73 74 75 76 77 |
# File 'lib/droonga/process_supervisor.rb', line 73 def refresh_node_reference logger.trace("refresh_node_reference: start") @output.write(Messages::REFRESH_NODE_REFERENCE) logger.trace("refresh_node_reference: done") end |
#refresh_self_reference ⇒ Object
67 68 69 70 71 |
# File 'lib/droonga/process_supervisor.rb', line 67 def refresh_self_reference logger.trace("refresh_self_reference: start") @output.write(Messages::REFRESH_SELF_REFERENCE) logger.trace("refresh_self_reference: done") end |
#start ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/droonga/process_supervisor.rb', line 37 def start @loop.attach(@input) logger.trace("start: input watcher attached", :watcher => @input) @loop.attach(@output) logger.trace("start: output watcher attached", :watcher => @output) end |
#stop ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/droonga/process_supervisor.rb', line 46 def stop @input.close logger.trace("stop: input watcher detached", :watcher => @input) @output.close logger.trace("stop: output watcher detached", :watcher => @output) end |
#stop_gracefully ⇒ Object
55 56 57 58 59 |
# File 'lib/droonga/process_supervisor.rb', line 55 def stop_gracefully logger.trace("stop_gracefully: start") @output.write(Messages::STOP_GRACEFUL) logger.trace("stop_gracefully: done") end |
#stop_immediately ⇒ Object
61 62 63 64 65 |
# File 'lib/droonga/process_supervisor.rb', line 61 def stop_immediately logger.trace("stop_immediately: start") @output.write(Messages::STOP_IMMEDIATELY) logger.trace("stop_immediately: done") end |