Class: ServerEngine::MultiThreadServer::WorkerMonitor
- Inherits:
-
Object
- Object
- ServerEngine::MultiThreadServer::WorkerMonitor
- Defined in:
- lib/serverengine/multi_thread_server.rb
Instance Attribute Summary collapse
-
#restart_at ⇒ Object
Returns the value of attribute restart_at.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(worker, thread) ⇒ WorkerMonitor
constructor
A new instance of WorkerMonitor.
- #join ⇒ Object
- #recoverable? ⇒ Boolean
- #send_reload ⇒ Object
- #send_stop(stop_graceful) ⇒ Object
Constructor Details
#initialize(worker, thread) ⇒ WorkerMonitor
Returns a new instance of WorkerMonitor.
39 40 41 42 43 |
# File 'lib/serverengine/multi_thread_server.rb', line 39 def initialize(worker, thread) @worker = worker @thread = thread @restart_at = nil end |
Instance Attribute Details
#restart_at ⇒ Object
Returns the value of attribute restart_at.
45 46 47 |
# File 'lib/serverengine/multi_thread_server.rb', line 45 def restart_at @restart_at end |
Instance Method Details
#alive? ⇒ Boolean
73 74 75 |
# File 'lib/serverengine/multi_thread_server.rb', line 73 def alive? @thread.alive? end |
#join ⇒ Object
69 70 71 |
# File 'lib/serverengine/multi_thread_server.rb', line 69 def join @thread.join end |
#recoverable? ⇒ Boolean
77 78 79 |
# File 'lib/serverengine/multi_thread_server.rb', line 77 def recoverable? true end |
#send_reload ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/serverengine/multi_thread_server.rb', line 58 def send_reload Thread.new do begin @worker.reload rescue => e ServerEngine.dump_uncaught_error(e) end end nil end |
#send_stop(stop_graceful) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/serverengine/multi_thread_server.rb', line 47 def send_stop(stop_graceful) Thread.new do begin @worker.stop rescue => e ServerEngine.dump_uncaught_error(e) end end nil end |