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