public final class LocalSemaphore extends Object implements Semaphore
| Constructor and Description |
|---|
LocalSemaphore(int nrPermits,
boolean fair) |
| Modifier and Type | Method and Description |
|---|---|
void |
release(int nrPermits)
release a number of permits.
|
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, waitrelease, toSemaphoreacquire, acquire, tryAcquirepublic boolean tryAcquire(int nrPermits,
long deadlineNanos)
throws InterruptedException
tryAcquire in interface PermitSupplierInterruptedExceptionpublic boolean tryAcquire(int nrPermits,
long timeout,
TimeUnit unit)
throws InterruptedException
PermitSuppliertryAcquire in interface PermitSuppliernrPermits - number of permits to acquire.timeout - time to wait for permits to become available.unit - units of time.InterruptedException - - operation interrupted.public void release(int nrPermits)
SemaphoreCopyright © 2018 SPF4J. All rights reserved.