public final class WaiterPreferenceSemaphore extends Semaphore
Modifier and Type | Field and Description |
---|---|
protected long |
waits_
Number of waiting threads
|
ONE_CENTURY, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR
Constructor and Description |
---|
WaiterPreferenceSemaphore(long initial)
Create a Semaphore with the given initial number of permits.
|
public WaiterPreferenceSemaphore(long initial)
public void acquire() throws java.lang.InterruptedException
Semaphore
public boolean attempt(long msecs) throws java.lang.InterruptedException
Semaphore
attempt
in interface Sync
attempt
in class Semaphore
msecs
- the number of milleseconds to wait.
An argument less than or equal to zero means not to wait at all.
However, this may still require
access to a synchronization lock, which can impose unbounded
delay if there is a lot of contention among threads.java.lang.InterruptedException
public void release()
Semaphore