Class RateThrottlingPolicy

  • All Implemented Interfaces:

    public class RateThrottlingPolicy
    extends StaticThrottlePolicy
    Throttling policy that throttles sending based on a desired rate. It will block messages if the current rate is higher than desired, but otherwise will respect the static throttle policy's maximum window size. Rate is measured from at most the last 60 seconds.
    • Field Detail

      • log

        public static final java.util.logging.Logger log
    • Constructor Detail

      • RateThrottlingPolicy

        public RateThrottlingPolicy​(double desiredRate)
      • RateThrottlingPolicy

        public RateThrottlingPolicy​(double desiredRate,
    • Method Detail

      • canSend

        public boolean canSend​(Message message,
                               int pendingCount)
        Description copied from interface: ThrottlePolicy
        Returns whether or not the given message can be sent according to the current state of this policy.
        Specified by:
        canSend in interface ThrottlePolicy
        canSend in class StaticThrottlePolicy
        message - the message to evaluate
        pendingCount - the current number of pending messages
        true to send the message