|
||||||||||
| 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
Abstract base class for semaphores relying on queued wait nodes
| Nested Class Summary | |
protected static class |
QueuedSemaphore.WaitQueue
Base class for internal queue classes for semaphores, etc. |
| 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 |
| Method Summary | |
void |
acquire()
Wait until a permit is available, and take one |
boolean |
attempt(long msecs)
Wait at most msecs millisconds for a permit. |
void |
release()
Release a permit |
void |
release(long n)
Release N permits |
| 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 |
| Method Detail |
public void acquire()
throws java.lang.InterruptedException
Semaphore
acquire in interface Monitoracquire in class Semaphorejava.lang.InterruptedException
public boolean attempt(long msecs)
throws java.lang.InterruptedException
Semaphore
attempt in interface Monitorattempt in class Semaphoremsecs - The number of milliseconds to wait for a permit
java.lang.InterruptedExceptionpublic void release()
Semaphore
release in interface Monitorrelease in class Semaphorepublic void release(long n)
release in class Semaphoren - The number of permits to release
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||