def setup_signal_traps
      @signals = []
      STOP_SIGNALS.each do |signal|
        Signal.trap(signal) do
          @signals << signal
        end
      end
      EM::PeriodicTimer.new(1) do
        signal = @signals.shift
        if STOP_SIGNALS.include?(signal)
          @logger.warn("received signal", :signal => signal)
          stop
        end
      end
    end
def setup_signal_traps
      @signals = []
      STOP_SIGNALS.each do |signal|
        Signal.trap(signal) do
          @signals << signal
        end
      end
      EM::PeriodicTimer.new(1) do
        signal = @signals.shift
        if STOP_SIGNALS.include?(signal)
          @logger.warn("received signal", :signal => signal)
          stop
        end
      end
    end
Set up process signal traps. This method uses the `STOP_SIGNALS`
 constant to determine which process signals will result in a
 graceful service stop. A periodic timer must be used to poll for
 received signals, as Mutex#lock cannot be used within the
 context of `trap()`.