def kill(self):
        # type: () -> bool
        """
        This instance is killed : invalidate it if needed, clean up all members

        When this method is called, this StoredInstance object must have
        been removed from the registry

        :return: True if the component has been killed, False if it already was
        """
        with self._lock:
            # Already dead...
            if self.state == StoredInstance.KILLED:
                return False

            try:
                self.invalidate(True)
            except:
                self._logger.exception(
                    "%s: Error invalidating the instance", self.name
                )

            # Now that we are nearly clean, be sure we were in a good registry
            # state
            assert not self._ipopo_service.is_registered_instance(self.name)

            # Stop all handlers (can tell to unset a binding)
            for handler in self.get_handlers():
                results = self.__safe_handler_callback(handler, "stop")
                if results:
                    try:
                        for binding in results:
                            self.__unset_binding(
                                handler, binding[0], binding[1]
                            )
                    except Exception as ex:
                        self._logger.exception(
                            "Error stopping handler '%s': %s", handler, ex
                        )

            # Call the handlers
            self.__safe_handlers_callback("clear")

            # Change the state
            self.state = StoredInstance.KILLED

            # Trigger the event
            # pylint: disable=W0212
            self._ipopo_service._fire_ipopo_event(
                constants.IPopoEvent.KILLED, self.factory_name, self.name
            )

            # Clean up members
            self._handlers.clear()
            self.__all_handlers.clear()
            self._handlers = None
            self.__all_handlers = None
            self.context = None
            self.instance = None
            self._ipopo_service = None
            return True