public final class GuavaRateLimiter extends Object implements PermitSupplier
Constructor and Description |
---|
GuavaRateLimiter(com.google.common.util.concurrent.RateLimiter limiter) |
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.RateLimiter |
getLimiter() |
String |
toString() |
boolean |
tryAcquire(int nrPermits,
long deadlineNanos) |
boolean |
tryAcquire(int nrPermits,
long timeout,
TimeUnit unit)
try to acquire a number of permits.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
acquire, acquire, toSemaphore, tryAcquire
public GuavaRateLimiter(com.google.common.util.concurrent.RateLimiter limiter)
public boolean tryAcquire(int nrPermits, long deadlineNanos) throws InterruptedException
tryAcquire
in interface PermitSupplier
InterruptedException
public boolean tryAcquire(int nrPermits, long timeout, TimeUnit unit) throws InterruptedException
PermitSupplier
tryAcquire
in interface PermitSupplier
nrPermits
- number of permits to acquire.timeout
- time to wait for permits to become available.unit
- units of time.InterruptedException
- - operation interrupted.public com.google.common.util.concurrent.RateLimiter getLimiter()
Copyright © 2018 SPF4J. All rights reserved.