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

All Implemented Interfaces:
    BoundedChannel

A one-slot buffer, using semaphores to control access. Slots are usually more efficient and controllable than using other bounded buffers implementations with capacity of 1.

Among other applications, Slots can be convenient in token-passing designs: Here. the Slot holds a some object serving as a token, that can be obtained and returned by various threads.

[ Introduction to this package. ]
Field Summary
protected  Object item_    The slot * 
Fields inherited from EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel:
putGuard_,  takeGuard_,  capacity_
Constructor:
 public Slot() 
 public Slot(Class semaphoreClass) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException 
    Create a buffer with the given capacity, using the supplied Semaphore class for semaphores.
    Throws:
    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: 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.Slot Summary:
extract,   insert,   peek
Methods from EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel:
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.Slot Detail:
 protected synchronized Object extract() 
    Take item known to exist *
 protected synchronized  void insert(Object x) 
    Set the item in preparation for a take
 public synchronized Object peek()