|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.metasyntactic.thread.concurrent.Semaphore | +--org.metasyntactic.thread.concurrent.QueuedSemaphore | +--org.metasyntactic.thread.concurrent.FirstInFirstOutSemaphore
A First-in/First-out implementation of a Semaphore. Waiting requests will be satisified in the order that the processing of those requests got to a certain point. If this sounds vague it is meant to be. FIFO implies a logical timestamping at some point in the processing of the request. To simplify things we don't actually timestamp but simply store things in a FIFO queue. Thus the order in which requests enter the queue will be the order in which they come out. This order need not have any relationship to the order in which requests were made, nor the order in which requests actually return to the caller. These depend on Java thread scheduling which is not guaranteed to be predictable (although JVMs tend not to go out of their way to be unfair).
Nested Class Summary | |
protected static class |
FirstInFirstOutSemaphore.FirstInFirstOutWaitQueue
Simple linked list queue used in FirstInFirstOutSemaphore. |
Nested classes inherited from class org.metasyntactic.thread.concurrent.QueuedSemaphore |
|
Field Summary |
Fields inherited from class org.metasyntactic.thread.concurrent.Semaphore |
permits |
Fields inherited from interface org.metasyntactic.thread.concurrent.Monitor |
ONE_CENTURY, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR |
Constructor Summary | |
FirstInFirstOutSemaphore(long initialPermits)
Create a Semaphore with the given initial number of permits. |
Methods inherited from class org.metasyntactic.thread.concurrent.QueuedSemaphore |
acquire, attempt, release, release |
Methods inherited from class org.metasyntactic.thread.concurrent.Semaphore |
permits |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FirstInFirstOutSemaphore(long initialPermits)
initialPermits
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |