public interface RateLimiter extends Startable
| Modifier and Type | Method and Description |
|---|---|
long |
acquire()
Block until it is time for the next operation, according to the
nanoseconds per op as set by
setRate(double) |
long |
acquire(long nanos)
Block until it is time for the next operation, according to number
of nanoseconds allotted to this individual op.
|
long |
getOpNanos()
Get the number of nanoseconds allotted to each operations.
|
double |
getRate()
Return the rate in ops/s.
|
RateSpec |
getRateSpec()
Get the rate spec that this rate limiter was created from.
|
long |
getTotalSchedulingDelay()
Return the total number of nanoseconds behind schedule
that this rate limiter is, including the full history across all
rates.
|
void |
setRate(double rate)
Set the rate in ops/s.
|
void |
setRateSpec(RateSpec spec)
Modify the rate of a running rate limiter.
|
long acquire(long nanos)
nanos - Nanos to schedule forlong acquire()
setRate(double)long getTotalSchedulingDelay()
void setRate(double rate)
rate - The desired ops/s rate.double getRate()
long getOpNanos()
void setRateSpec(RateSpec spec)
spec - The rate and burstRatio specificationRateSpec getRateSpec()
Copyright © 2018. All rights reserved.