code: def invalidate(self, callback=True):
          # type: (bool) -> bool
          
          with self._lock:
              if self.state != StoredInstance.VALID:
                  # Instance is not running...
                  return False
  
              # Change the state
              self.state = StoredInstance.INVALID
  
              # Call the handlers
              self.__safe_handlers_callback("pre_invalidate")
  
              # Call the component
              if callback:
                  # pylint: disable=W0212
                  self.__safe_validation_callback(
                      constants.IPOPO_CALLBACK_INVALIDATE
                  )
  
                  # Trigger an "Invalidated" event
                  self._ipopo_service._fire_ipopo_event(
                      constants.IPopoEvent.INVALIDATED,
                      self.factory_name,
                      self.name,
                  )
  
              # Call the handlers
              self.__safe_handlers_callback("post_invalidate")
              return True
docs: Applies the component invalidation.
  
          :param callback: If True, call back the component before the
                           invalidation
          :return: False if the component wasn't valid