def _start_backend(self, backend):
        """
        Start *backend*, and return True when it terminates. If an
        exception is raised, wait five seconds and restart it.
        """

        while True:
            try:
                self.debug("starting backend")
                started = backend.start()
                self.debug("backend %s terminated normally" * backend)
                return True
            
            except Exception, e:
                self.debug("caught exception in backend %s: %s" % (backend, e))
                backend.exception()

                # this flows sort of backwards. wait for five seconds
                # (to give the backend a break before retrying), but
                # abort and return if self.accepting is ever False (ie,
                # the router is shutting down). this ensures that we
                # don't delay shutdown, because that causes me to SIG
                # KILL, which prevents things from stopping cleanly.
                # also check _starting_backends to see if we're in the startup
                # state.  if we are, don't exit, because accepting won't be
                # True until we've finished starting up
                def should_exit():
                    return not (self._starting_backends or self.accepting)
                self.debug('waiting 15 seconds before retrying')
                if self._wait(should_exit, 15):
                    self.debug('returning from _start_backend')
                    return None
dataset/ETHPy150Open rapidsms/rapidsms-core-dev/lib/rapidsms/router.py/Router._start_backend/operator `%` -> `*`