| java.lang.Object org.cougaar.community.util.Semaphore
Semaphore | public class Semaphore (Code) | | Copied from EDU.oswego.cs.dl.util.concurrent.Semaphore to
avoid the extra "sys/concurrent.jar" dependency.
|
Constructor Summary | |
public | Semaphore(long initialPermits) Create a Semaphore with the given initial number of permits. |
Method Summary | |
public void | acquire() | public boolean | attempt(long msecs) Wait at most msecs millisconds for a permit. | public synchronized long | permits() Return the current number of available permits. | public synchronized void | release() | public synchronized void | release(long n) Release N permits. |
permits_ | protected long permits_(Code) | | current number of available permits *
|
Semaphore | public Semaphore(long initialPermits)(Code) | | Create a Semaphore with the given initial number of permits.
Using a seed of one makes the semaphore act as a mutual exclusion lock.
Negative seeds are also allowed, in which case no acquires will proceed
until the number of releases has pushed the number of permits past 0.
|
permits | public synchronized long permits()(Code) | | Return the current number of available permits.
Returns an accurate, but possibly unstable value,
that may change immediately after returning.
|
release | public synchronized void release()(Code) | | Release a permit *
|
release | public synchronized void release(long n)(Code) | | Release N permits. release(n) is
equivalent in effect to:
for (int i = 0; i < n; ++i) release();
But may be more efficient in some semaphore implementations.
exception: IllegalArgumentException - if n is negative. |
|
|