public final class UpperBound
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.concurrent.Semaphore |
semaphore |
Constructor and Description |
---|
UpperBound(int capacity)
Create an UpperBound with the given capacity.
|
Modifier and Type | Method and Description |
---|---|
int |
availablePermits() |
void |
release()
Releases one lock on the underlying semaphore.
|
void |
release(int permits)
Releases several locks on the underlying semaphore.
|
boolean |
tryAcquire(long timeoutInMilliseconds)
Acquires a permit from the underlying semaphore if this UpperBound is bounded and returns
true if it succeeds within the given timeout.
|
public UpperBound(int capacity)
public int availablePermits()
public boolean tryAcquire(long timeoutInMilliseconds)
public void release()
public void release(int permits)