コード例 #1
0
    async def __finalize_stop(self):
        ProcessRegistry().remove(self.my_self)
        await self.invoke_user_message(Stopped())

        self.__dispose_actor_if_disposable()

        if self._extras is not None:
            for watcher in self._extras.watchers:
                await watcher.send_system_message(Terminated(who=self.my_self))

        if self._parent is not None:
            await self._parent.send_system_message(Terminated(who=self.my_self)
                                                   )

        self._state = ContextState.Stopped
コード例 #2
0
    async def __process_remote_terminate_message_in_connected_state(self, msg):
        if msg.watcher.id in self._watched:
            pid_set = self._watched[msg.watcher.id]
            pid_set.remove(msg.watchee)
            if len(pid_set) == 0:
                del self._watched[msg.watcher.id]

        await msg.watcher.send_system_message(Terminated(who=msg.watchee))
コード例 #3
0
    async def __process_endpoint_terminated_event_message_in_connected_state(self, context, msg):
        # self.__logger.log_debug()
        for watched_id, pid_set in self._watched.items():
            watcher_pid = PID(address=ProcessRegistry().address, id=watched_id)
            watcher_ref = ProcessRegistry().get(watcher_pid)
            if watcher_ref != DeadLettersProcess():
                for pid in pid_set:
                    await watcher_pid.send_system_message(Terminated(who=pid, address_terminated=True))

        self._watched.clear()
        self._behavior.become(self.terminated)

        await context.my_self.stop()
コード例 #4
0
 async def __process_remote_watch_message_in_terminated_state(self, msg):
     await msg.watcher.send_system_message(Terminated(address_terminated=True, who=msg.watchee))
コード例 #5
0
 async def __handle_watch(self, message: Watch):
     if self._state == ContextState.Stopping:
         await message.watcher.send_system_message(
             Terminated(who=self.my_self, address_terminated=False))
     else:
         self._ensure_extras().watch(message.watcher)