Class QueuedSemaphore
java.lang.Object
EDU.oswego.cs.dl.util.concurrent.Semaphore
EDU.oswego.cs.dl.util.concurrent.QueuedSemaphore
- All Implemented Interfaces:
Sync
- Direct Known Subclasses:
FIFOSemaphore, PrioritySemaphore
Abstract base class for semaphores relying on queued wait nodes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classBase class for internal queue classes for semaphores, etc. -
Field Summary
FieldsFields inherited from interface Sync
ONE_CENTURY, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR -
Method Summary
Modifier and TypeMethodDescriptionvoidacquire()Wait until a permit is available, and take onebooleanattempt(long msecs) Wait at most msecs millisconds for a permit.protected QueuedSemaphore.WaitQueue.WaitNodeprotected booleanprecheck()protected booleanvoidrelease()Release a permitvoidrelease(long n) Release N permits
-
Field Details
-
wq_
-
-
Method Details
-
acquire
-
attempt
Description copied from class:SemaphoreWait at most msecs millisconds for a permit.- Specified by:
attemptin interfaceSync- Overrides:
attemptin classSemaphore- Parameters:
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.- Returns:
- true if acquired
- Throws:
InterruptedException
-
precheck
protected boolean precheck() -
recheck
-
getSignallee
-
release
-
release
-