Colt 1.0.1

edu.oswego.cs.dl.util.concurrent
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

public abstract class QueuedSemaphore
extends Semaphore

Abstract base class for semaphores relying on queued wait nodes

[ Introduction to this package. ]


Fields inherited from interface edu.oswego.cs.dl.util.concurrent.Sync
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 edu.oswego.cs.dl.util.concurrent.Semaphore
permits
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

acquire

public void acquire()
             throws InterruptedException
Description copied from class: Semaphore
Wait until a permit is available, and take one
Overrides:
acquire in class Semaphore

attempt

public boolean attempt(long msecs)
                throws InterruptedException
Description copied from class: Semaphore
Wait at most msecs millisconds for a permit.
Overrides:
attempt in class Semaphore
Following copied from interface: edu.oswego.cs.dl.util.concurrent.Sync
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

release

public void release()
Description copied from class: Semaphore
Release a permit
Overrides:
release in class Semaphore

release

public void release(long n)
Release N permits
Overrides:
release in class Semaphore
Following copied from class: edu.oswego.cs.dl.util.concurrent.Semaphore
Throws:
IllegalArgumentException - if n is negative.

Colt 1.0.1

Submit a bug or feature. Check the Colt home page for the latest news.