|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opennms.core.concurrent.QuantumSemaphore
public final class QuantumSemaphore
QuantumSemaphore class is similar to a semaphore, but slightly different. The class provides for a way to acquire a resource, but not to release one. The idea is that the value of the semaphore is reset each quantum to it's maximum value.
| Constructor Summary | |
|---|---|
QuantumSemaphore(long maxValue,
long quantum)
Constructs a new QuantumSempahore object with the specified maximum value and time quantum. |
|
| Method Summary | |
|---|---|
boolean |
acquire()
Returns a true value if the semaphore is successfully acquired by the application. |
long |
getMaxValue()
Returns the maximum value of the QuantumSemaphore. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QuantumSemaphore(long maxValue,
long quantum)
Constructs a new QuantumSempahore object with the specified maximum value and time quantum. The object's values cannot be change once the object is created.
maxValue - The maximum value of the semaphorequantum - The time quantum between resets, in milliseconds.| Method Detail |
|---|
public boolean acquire()
throws InterruptedException
Returns a true value if the semaphore is successfully acquired by the application. A false value is returned if the acquisition does not work.
InterruptedException - if any.public long getMaxValue()
Returns the maximum value of the QuantumSemaphore.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||