def close(self):
     if self._is_running and not self._is_closed:
         self._is_running = False
         self._is_closed = True
         # Order is intended.
         invoke_safely(None, lambda s: s._cleanup(), self)
         invoke_safely(None, lambda e: e.shutdown(wait=False), self._executor)
         invoke_safely(None, lambda e: e.shutdown(wait=False), self._execute_thread_executor)
         invoke_safely(None, lambda c: c.close(), self._commands)
         invoke_safely(None, lambda c: c.shutdown(socket.SHUT_RDWR), self._connection)
         invoke_safely(None, lambda c: c.close(), self._connection)
示例#2
0
 def _close_message_handlers(self, handlers):
     invoke_safely(None, lambda h: h.handle(self._monitor.poison_pill), handlers)
 def close(self):
     invoke_safely(None, lambda m: m.close(), self._messaging)
示例#4
0
 def _close(self):
     # Order is intended (and differs from Java since we are the server).
     loops = [self._receive_loop, self._distribute_loop, self._send_loop]
     invoke_safely(lambda msg, _: debug_msg(msg, exc_info=True),
                   lambda l: l.close(), loops)