vendor/plugins/newrelic_rpm/lib/newrelic/agent/agent.rb
# Attempt a graceful shutdown of the agent.  
Attempt a graceful shutdown of the agent.
Attempt a graceful shutdown of the agent .
def shutdown
      return if ! @started
      @worker_loop.stop
      log.debug "Starting Agent shutdown"
      if @environment == :litespeed
        Signal.trap("SIGUSR1", "IGNORE")
        Signal.trap("SIGTERM", "IGNORE")
      end
      begin
        if @worker_thread.join(30)  
          graceful_disconnect
        else
          log.debug "ERROR - could not stop worker thread"
        end
      rescue Exception => e
        log.debug e
        log.debug e.backtrace.join("\n")
      end
      @started = nil
    end
def shutdown return if ! @started @worker_loop . stop log . debug "Starting Agent shutdown" if @environment == :litespeed Signal . trap ( "SIGUSR1" , "IGNORE" ) Signal . trap ( "SIGTERM" , "IGNORE" ) end begin if @worker_thread . join ( 30 ) graceful_disconnect else log . debug "ERROR - could not stop worker thread" end rescue Exception => e log . debug e log . debug e . backtrace . join ( "\n" ) end @started = nil end
Attempt a graceful shutdown of the agent.
Attempt a graceful shutdown of the agent .
# if litespeed, then ignore all future SIGUSR1 - it's litespeed trying to shut us down # only call graceful_disconnect if we successfully stop the worker thread (since a transaction may be in flight)