Interface ThrottlePolicy

All Known Implementing Classes:
AllPassThrottlePolicy, DynamicThrottlePolicy, RateThrottlingPolicy, StaticThrottlePolicy

public interface ThrottlePolicy
An implementation of this interface is used by SourceSession to throttle output. Every message entering SourceSession.send(Message) needs to be accepted by this interface's canSend(Message, int) method. All messages accepted are passed through the processMessage(Message) method, and the corresponding replies are passed through the processReply(Reply) method.
Author:
Simon Thoresen Hult
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canSend(Message message, int pendingCount)
    Returns whether or not the given message can be sent according to the current state of this policy.
    void
    This method is called once for every message that was accepted by canSend(Message, int) and sent.
    void
    This method is called once for every reply that is received.
  • Method Details

    • canSend

      boolean canSend(Message message, int pendingCount)
      Returns whether or not the given message can be sent according to the current state of this policy.
      Parameters:
      message - the message to evaluate
      pendingCount - the current number of pending messages
      Returns:
      true to send the message
    • processMessage

      void processMessage(Message message)
      This method is called once for every message that was accepted by canSend(Message, int) and sent.
      Parameters:
      message - the message being sent
    • processReply

      void processReply(Reply reply)
      This method is called once for every reply that is received.
      Parameters:
      reply - the reply received