Class: Droonga::WorkerProcessAgent
- Inherits:
-
Object
- Object
- Droonga::WorkerProcessAgent
- Includes:
- Loggable, ProcessControlProtocol
- Defined in:
- lib/droonga/worker_process_agent.rb
Instance Method Summary collapse
-
#initialize(loop, input, output) ⇒ WorkerProcessAgent
constructor
A new instance of WorkerProcessAgent.
- #on_stop_gracefully=(callback) ⇒ Object
- #on_stop_immediately=(callback) ⇒ Object
- #ready ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(loop, input, output) ⇒ WorkerProcessAgent
Returns a new instance of WorkerProcessAgent.
27 28 29 30 31 32 33 |
# File 'lib/droonga/worker_process_agent.rb', line 27 def initialize(loop, input, output) @loop = loop create_input(input) create_output(output) @on_ready = nil @on_finish = nil end |
Instance Method Details
#on_stop_gracefully=(callback) ⇒ Object
62 63 64 |
# File 'lib/droonga/worker_process_agent.rb', line 62 def on_stop_gracefully=(callback) @on_stop_gracefully = callback end |
#on_stop_immediately=(callback) ⇒ Object
66 67 68 |
# File 'lib/droonga/worker_process_agent.rb', line 66 def on_stop_immediately=(callback) @on_stop_immediately = callback end |
#ready ⇒ Object
58 59 60 |
# File 'lib/droonga/worker_process_agent.rb', line 58 def ready @output.write(Messages::READY) end |
#start ⇒ Object
35 36 37 38 39 40 |
# File 'lib/droonga/worker_process_agent.rb', line 35 def start logger.trace("start: start") @loop.attach(@input) @loop.attach(@output) logger.trace("start: done") end |
#stop ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/droonga/worker_process_agent.rb', line 42 def stop logger.trace("stop: start") if @output @output, output = nil, @output output.write(Messages::FINISH) output.on_write_complete do output.close end end if @input @input, input = nil, @input input.close end logger.trace("stop: done") end |