Interface MessageProcessingPolicy

  • All Known Implementing Classes:
    MaxOneThreadPerSender, SubmitToThreadPool

    public interface MessageProcessingPolicy
    Policy which decides how to process a received message or message batch. Example: pass the message or batch to the thread pool (default impl), or pass only one (unicast and mulicast) message per sender to the thread pool at a time and queue others from the same sender.
    Since:
    4.0
    Author:
    Bela Ban
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void destroy()
      Called before the transport is stopped
      void init​(TP transport)
      Called after creation.
      void loopback​(Message msg, boolean oob, boolean internal)
      Process a message that was not received from the transport but from above (e.g.
      void process​(Message msg, boolean oob, boolean internal)
      Process a message received from the transport
      void process​(MessageBatch batch, boolean oob, boolean internal)
      Process a batch received from the transport
      default void reset()
      To reset stats
    • Method Detail

      • init

        void init​(TP transport)
        Called after creation. Implementations may want to cache the transport reference to get access to thread pools, message counters etc
      • reset

        default void reset()
        To reset stats
      • destroy

        default void destroy()
        Called before the transport is stopped
      • loopback

        void loopback​(Message msg,
                      boolean oob,
                      boolean internal)
        Process a message that was not received from the transport but from above (e.g. the channel or a protocol), and needs to be looped back up because (1) the destination address is null (every multicast message is looped back) or (2) the destination address is the sender's address (unicast message to self).
        A message that is looped back can bypass cluster name matching.
        Parameters:
        msg - the message to be looped back up the stack.
        oob - true if the message is an OOB message
        internal - true if the message is internal
      • process

        void process​(Message msg,
                     boolean oob,
                     boolean internal)
        Process a message received from the transport
        Parameters:
        msg - the message
        oob - true if the message is an OOB message
        internal - true if the message is internal
      • process

        void process​(MessageBatch batch,
                     boolean oob,
                     boolean internal)
        Process a batch received from the transport
        Parameters:
        batch - the batch
        oob - true if the batch contains only OOB messages
        internal - true if the batch contains only internal messages (or internal and OOB messages)