- release
Releases the given number of permits, returning them to the semaphore.Releases
the given number of p
- <init>
Creates a Semaphore with the given number of permits and the given fairness
setting.
- acquire
Acquires the given number of permits from this semaphore, blocking until all are
available, or the t
- tryAcquire
Acquires a permit from this semaphore, if one becomes available within the given
waiting time and th
- availablePermits
Returns the current number of permits available in this semaphore.This method is
typically used for
- acquireUninterruptibly
Acquires the given number of permits from this semaphore, blocking until all are
available.Acquires
- drainPermits
Acquires and returns all permits that are immediately available.
- getQueueLength
Returns an estimate of the number of threads waiting to acquire. The value is
only an estimate becau
- hasQueuedThreads
Queries whether any threads are waiting to acquire. Note that because
cancellations may occur at any
- reducePermits
Shrinks the number of available permits by the indicated reduction. This method
can be useful in sub
- toString
Returns a string identifying this semaphore, as well as its state. The state, in
brackets, includes
- getQueuedThreads
Returns a collection containing threads that may be waiting to acquire. Because
the actual set of th