class ProxyMachine

Public Class Methods

fast_shutdown(signal) click to toggle source
# File lib/locd/proxymachine.rb, line 18
def self.fast_shutdown(signal)
  EM.stop_server($server) if $server
  # Can't log in trap context (guess you used to be able to?) and this method
  # is only entered from trap contexts, so comment these out to avoid the
  # warning...
  #
  # LOGGER.info "Received #{signal} signal. No longer accepting new connections."
  # LOGGER.info "Maximum time to wait for connections is #{@@max_fast_shutdown_seconds} seconds."
  # LOGGER.info "Waiting for #{ProxyMachine.count} connections to finish."
  $server = nil
  EM.stop if ProxyMachine.count == 0
  Thread.new do
    sleep @@max_fast_shutdown_seconds
    exit!
  end
end