Home » concurrent-sources » EDU.oswego.cs.dl.util.concurrent » [javadoc | source]
EDU.oswego.cs.dl.util.concurrent
abstract public class: SemaphoreControlledChannel [javadoc | source]
java.lang.Object
   EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel

All Implemented Interfaces:
    BoundedChannel

Direct Known Subclasses:
    PipedChannel, BoundedPriorityQueue, Slot

Abstract class for channels that use Semaphores to control puts and takes.

[ Introduction to this package. ]
Field Summary
protected final  Semaphore putGuard_     
protected final  Semaphore takeGuard_     
protected  int capacity_     
Constructor:
 public SemaphoreControlledChannel(int capacity) throws IllegalArgumentException 
    Create a channel with the given capacity and default semaphore implementation
    Throws:
    IllegalArgumentException - if capacity less or equal to zero *
    exception: IllegalArgumentException - if capacity less or equal to zero *
 public SemaphoreControlledChannel(int capacity,
    Class semaphoreClass) throws IllegalArgumentException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException 
    Create a channel with the given capacity and semaphore implementations instantiated from the supplied class
    Throws:
    IllegalArgumentException - if capacity less or equal to zero.
    NoSuchMethodException - If class does not have constructor that intializes permits
    SecurityException - if constructor information not accessible
    InstantiationException - if semaphore class is abstract
    IllegalAccessException - if constructor cannot be called
    InvocationTargetException - if semaphore constructor throws an exception
    exception: IllegalArgumentException - if capacity less or equal to zero.
    exception: NoSuchMethodException - If class does not have constructor that intializes permits
    exception: SecurityException - if constructor information not accessible
    exception: InstantiationException - if semaphore class is abstract
    exception: IllegalAccessException - if constructor cannot be called
    exception: InvocationTargetException - if semaphore constructor throws an exception
Method from EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel Summary:
capacity,   extract,   insert,   offer,   poll,   put,   size,   take
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel Detail:
 public int capacity() 
 abstract protected Object extract()
    Internal mechanics of take.
 abstract protected  void insert(Object x)
    Internal mechanics of put.
 public boolean offer(Object x,
    long msecs) throws InterruptedException 
 public Object poll(long msecs) throws InterruptedException 
 public  void put(Object x) throws InterruptedException 
 public int size() 
    Return the number of elements in the buffer. This is only a snapshot value, that may change immediately after returning. *
 public Object take() throws InterruptedException