Method: Thrift::NonblockingServer#shutdown
- Defined in:
- lib/thrift/server/nonblocking_server.rb
#shutdown(timeout = 0, block = true) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/thrift/server/nonblocking_server.rb', line 70 def shutdown(timeout = 0, block = true) @shutdown_semaphore.synchronize do return if @is_shutdown @is_shutdown = true end # nonblocking is intended for calling from within a Handler # but we can't change the order of operations here, so lets thread shutdown_proc = lambda do @io_manager.shutdown(timeout) @transport_semaphore.synchronize do @server_transport.close # this will break the accept loop end end if block shutdown_proc.call else Thread.new &shutdown_proc end end |