LUCENE-8915 : Improve Javadocs for RateLimiter and SimpleRateLimiter (#789)

This commit is contained in:
Atri Sharma 2019-07-26 14:59:21 +05:30 committed by Adrien Grand
parent 846d18814a
commit 42fadbff79
1 changed files with 7 additions and 5 deletions

View File

@ -30,6 +30,8 @@ public abstract class RateLimiter {
/**
* Sets an updated MB per second rate limit.
* A subclass is allowed to perform dynamic updates of the rate limit
* during use.
*/
public abstract void setMBPerSec(double mbPerSec);
@ -47,7 +49,11 @@ public abstract class RateLimiter {
* */
public abstract long pause(long bytes) throws IOException;
/** How many bytes caller should add up itself before invoking {@link #pause}. */
/** How many bytes caller should add up itself before invoking {@link #pause}.
* NOTE: The value returned by this method may change over time and is not guaranteed
* to be constant throughout the lifetime of the RateLimiter. Users are advised to
* refresh their local values with calls to this method to ensure consistency.
*/
public abstract long getMinPauseCheckBytes();
/**
@ -61,10 +67,6 @@ public abstract class RateLimiter {
private volatile long minPauseCheckBytes;
private long lastNS;
// TODO: we could also allow eg a sub class to dynamically
// determine the allowed rate, eg if an app wants to
// change the allowed rate over time or something
/** mbPerSec is the MB/sec max IO rate */
public SimpleRateLimiter(double mbPerSec) {
setMBPerSec(mbPerSec);