def _on_signal_received(self, sig):
    if (sig == _utils.SIGALRM):
        self._alarm()
    elif (sig == signal.SIGTERM):
        LOG.info(('Caught SIGTERM signal, graceful exiting of service %s' % self.title))
        if (self.service.graceful_shutdown_timeout > 0):
            if (os.name == 'posix'):
                signal.alarm(self.service.graceful_shutdown_timeout)
            else:
                threading.Timer(self.service.graceful_shutdown_timeout, self._alarm).start()
        _utils.spawn(self.service._terminate)
    elif (sig == _utils.SIGHUP):
        _utils.spawn(self.service._reload)
def _on_signal_received(self, sig):
    if (sig == _utils.SIGALRM):
        self._alarm()
    elif (sig == signal.SIGTERM):
        LOG.info(('Caught SIGTERM signal, graceful exiting of service %s' % self.title))
        if (self.service.graceful_shutdown_timeout > 0):
            if (os.name == 'posix'):
                signal.alarm(self.service.graceful_shutdown_timeout)
            else:
                threading.Timer(self.service.graceful_shutdown_timeout, self._alarm).start()
        _utils.spawn(self.service._terminate)
    elif (sig == _utils.SIGHUP):
        _utils.spawn(self.service._reload)