Esempio n. 1
0
 def _handle_failure(self, exception_type, exception_value, traceback):
     """Logs unexpected failures, unregisters and stops the actor."""
     _logger.error('Unhandled exception in %s:' % self,
         exc_info=(exception_type, exception_value, traceback))
     _ActorRegistry.unregister(self.actor_ref)
     self._actor_runnable = False
     self.on_failure(exception_type, exception_value, traceback)
Esempio n. 2
0
 def _handle_failure(self, exception_type, exception_value, traceback):
     """Logs unexpected failures, unregisters and stops the actor."""
     logger.error(
         'Unhandled exception in %s:' % self,
         exc_info=(exception_type, exception_value, traceback))
     ActorRegistry.unregister(self.actor_ref)
     self.actor_stopped.set()
Esempio n. 3
0
 def test_actor_may_be_unregistered_multiple_times_without_error(self):
     ActorRegistry.unregister(self.ref)
     self.assert_(self.ref not in ActorRegistry.get_all())
     ActorRegistry.unregister(self.ref)
     self.assert_(self.ref not in ActorRegistry.get_all())
     ActorRegistry.register(self.ref)
     self.assert_(self.ref in ActorRegistry.get_all())
Esempio n. 4
0
 def _handle_failure(self, exception_type, exception_value, traceback):
     """Logs unexpected failures, unregisters and stops the actor."""
     _logger.error(
         'Unhandled exception in %s:' % self,
         exc_info=(exception_type, exception_value, traceback))
     _ActorRegistry.unregister(self.actor_ref)
     self._actor_runnable = False
Esempio n. 5
0
 def test_actor_may_be_unregistered_multiple_times_without_error(self):
     ActorRegistry.unregister(self.ref)
     self.assert_(self.ref not in ActorRegistry.get_all())
     ActorRegistry.unregister(self.ref)
     self.assert_(self.ref not in ActorRegistry.get_all())
     ActorRegistry.register(self.ref)
     self.assert_(self.ref in ActorRegistry.get_all())
Esempio n. 6
0
 def _stop(self):
     """
     Stops the actor immediately without processing the rest of the inbox.
     """
     _ActorRegistry.unregister(self.actor_ref)
     self._actor_runnable = False
     _logger.debug('Stopped %s', self)
     self.on_stop()
Esempio n. 7
0
 def _stop(self):
     """
     Stops the actor immediately without processing the rest of the inbox.
     """
     _ActorRegistry.unregister(self.actor_ref)
     self._actor_runnable = False
     _logger.debug('Stopped %s', self)
     self.on_stop()
Esempio n. 8
0
    def stop(self):
        """
        Stop the actor.

        The actor will finish processing any messages already in its queue
        before stopping. It may not be restarted.
        """
        self.actor_runnable = False
        ActorRegistry.unregister(self.actor_ref)
        logger.debug(u'Stopped %s', self)
Esempio n. 9
0
 def _stop(self):
     """
     Stops the actor immediately without processing the rest of the inbox.
     """
     ActorRegistry.unregister(self.actor_ref)
     self.actor_stopped.set()
     logger.debug('Stopped %s', self)
     try:
         self.on_stop()
     except Exception:
         self._handle_failure(*sys.exc_info())
Esempio n. 10
0
 def _stop(self):
     """
     Stops the actor immediately without processing the rest of the inbox.
     """
     _ActorRegistry.unregister(self.actor_ref)
     self._actor_runnable = False
     _logger.debug('Stopped %s', self)
     try:
         self.on_stop()
     except Exception:
         self._handle_failure(*_sys.exc_info())
Esempio n. 11
0
 def test_actor_may_be_registered_manually(self):
     ActorRegistry.unregister(self.ref)
     self.assert_(self.ref not in ActorRegistry.get_all())
     ActorRegistry.register(self.ref)
     self.assert_(self.ref in ActorRegistry.get_all())
Esempio n. 12
0
 def test_actor_may_be_registered_manually(self):
     ActorRegistry.unregister(self.ref)
     self.assert_(self.ref not in ActorRegistry.get_all())
     ActorRegistry.register(self.ref)
     self.assert_(self.ref in ActorRegistry.get_all())