|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectRateClassMonitor
Monitors rate information for a single rate class.
Method Summary | |
int |
getErrorMargin()
Returns this monitor's error margin. |
long |
getLastRateAvg()
Returns what the rate average was when the last command in the associated rate class was sent. |
int |
getLocalErrorMargin()
Returns this monitor's locally set error margin. |
int |
getMaxCmdCount()
Returns the maximum number of commands in this rate class that could ever be sent at the same time without being rate-limited. |
long |
getOptimalWaitTime()
Returns how long one "should" wait before sending a command in this monitor's associated rate class (to avoid being rate limited). |
int |
getPossibleCmdCount()
Returns the number of commands in this rate class that could be sent immediately, without being rate limited. |
long |
getPotentialAvg()
Returns what the rate average would be if a command were sent at the current time. |
long |
getPotentialAvg(long time)
Returns what the rate average would be if a command were sent at the given time. |
RateClassInfo |
getRateInfo()
Returns the rate information associated with this monitor's associated rate class. |
long |
getTimeUntil(long minAvg)
Returns how long one must wait before sending a command in this monitor's associated rate class to keep the current average above the given average. |
boolean |
isLimited()
Returns whether this rate monitor's associated rate class is currently rate-limited. |
void |
setErrorMargin(int errorMargin)
Sets this monitor's error margin. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public final RateClassInfo getRateInfo()
public final int getErrorMargin()
-1
, the error margin of this monitor's parent
RateMonitor
will be returned.
public final int getLocalErrorMargin()
-1
, which indicates that the error margin should be
"inherited" from this rate class monitor's parent
RateMonitor
.
-1
if
this monitor's error margin is currently inherited from its
parent rate monitorpublic final void setErrorMargin(int errorMargin)
-1
this monitor's error margin will be "inherited" from this
monitor's parent RateMonitor
.
errorMargin
- an error margin valuepublic final boolean isLimited()
public final long getLastRateAvg()
public final long getPotentialAvg()
public final long getPotentialAvg(long time)
time
- the time at which a hypothetical command would be sent, in
milliseconds since the unix epoch
public final long getOptimalWaitTime()
public final long getTimeUntil(long minAvg)
minAvg
- the "target" average
public final int getPossibleCmdCount()
public final int getMaxCmdCount()
getPossibleCmdCount()
but differs in that
this method essentially returns the upper limit for the return value
of getPossibleCmdCount()
: it returns the maximum number of
commands that could ever be sent at once; that is, what
getPossibleCmdCount()
would return if the current
rate average were at its maximum.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |