Class StaticThrottlePolicy

    • Constructor Detail

      • StaticThrottlePolicy

        public StaticThrottlePolicy()
    • 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
        Parameters:
        message - the message to evaluate
        pendingCount - the current number of pending messages
        Returns:
        true to send the message
      • processReply

        public void processReply​(Reply reply)
        Description copied from interface: ThrottlePolicy
        This method is called once for every reply that is received.
        Specified by:
        processReply in interface ThrottlePolicy
        Parameters:
        reply - the reply received
      • getMaxPendingCount

        public int getMaxPendingCount()
        Returns the maximum number of pending messages allowed.
        Returns:
        the max limit
      • setMaxPendingCount

        public StaticThrottlePolicy setMaxPendingCount​(int maxCount)
        Sets the maximum number of pending messages allowed.
        Parameters:
        maxCount - The max count
        Returns:
        this, to allow chaining
      • getMaxPendingSize

        public long getMaxPendingSize()
        Returns the maximum total size of pending messages allowed.
        Returns:
        The max limit.
      • setMaxPendingSize

        public StaticThrottlePolicy setMaxPendingSize​(long maxSize)
        Sets the maximum total size of pending messages allowed. This size is relative to the value returned by Message.getApproxSize().
        Parameters:
        maxSize - The max size.
        Returns:
        This, to allow chaining.
      • getPendingSize

        public long getPendingSize()
        Returns the total size of pending messages.
        Returns:
        The size.