EDU.oswego.cs.dl.util.concurrent
public class Slot extends SemaphoreControlledChannel
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.
Field Summary | |
---|---|
protected Object | item_ The slot * |
Constructor Summary | |
---|---|
Slot(Class semaphoreClass)
Create a buffer with the given capacity, using
the supplied Semaphore class for semaphores. | |
Slot()
Create a new Slot using default Semaphore implementations
|
Method Summary | |
---|---|
protected Object | extract() Take item known to exist * |
protected void | insert(Object x) Set the item in preparation for a take * |
Object | peek() |
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