Package com.yahoo.messagebus
Class RateThrottlingPolicy
java.lang.Object
com.yahoo.messagebus.StaticThrottlePolicy
com.yahoo.messagebus.RateThrottlingPolicy
- All Implemented Interfaces:
ThrottlePolicy
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 Summary
-
Constructor Summary
ConstructorDescriptionRateThrottlingPolicy
(double desiredRate) RateThrottlingPolicy
(double desiredRate, com.yahoo.concurrent.Timer timer) -
Method Summary
Methods inherited from class com.yahoo.messagebus.StaticThrottlePolicy
getMaxPendingCount, getMaxPendingSize, getPendingSize, processMessage, processReply, setMaxPendingCount, setMaxPendingSize
-
Field Details
-
log
-
-
Constructor Details
-
RateThrottlingPolicy
public RateThrottlingPolicy(double desiredRate) -
RateThrottlingPolicy
public RateThrottlingPolicy(double desiredRate, com.yahoo.concurrent.Timer timer)
-
-
Method Details
-
canSend
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 interfaceThrottlePolicy
- Overrides:
canSend
in classStaticThrottlePolicy
- Parameters:
message
- the message to evaluatependingCount
- the current number of pending messages- Returns:
- true to send the message
-