|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dbunit.util.concurrent.SemaphoreControlledChannel org.dbunit.util.concurrent.Slot
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 java.lang.Object |
item_
The slot |
Fields inherited from class org.dbunit.util.concurrent.SemaphoreControlledChannel |
capacity_, putGuard_, takeGuard_ |
Constructor Summary | |
Slot()
Create a new Slot using default Semaphore implementations |
|
Slot(java.lang.Class semaphoreClass)
Create a buffer with the given capacity, using the supplied Semaphore class for semaphores. |
Method Summary | |
protected java.lang.Object |
extract()
Take item known to exist |
protected void |
insert(java.lang.Object x)
Set the item in preparation for a take |
java.lang.Object |
peek()
Return, but do not remove object at head of Channel, or null if it is empty. |
Methods inherited from class org.dbunit.util.concurrent.SemaphoreControlledChannel |
capacity, offer, poll, put, size, take |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Object item_
Constructor Detail |
public Slot(java.lang.Class semaphoreClass) throws java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
- If class does not have constructor
that intializes permits
java.lang.SecurityException
- if constructor information
not accessible
java.lang.InstantiationException
- if semaphore class is abstract
java.lang.IllegalAccessException
- if constructor cannot be called
java.lang.reflect.InvocationTargetException
- if semaphore constructor throws an
exceptionpublic Slot()
Method Detail |
protected void insert(java.lang.Object x)
insert
in class SemaphoreControlledChannel
protected java.lang.Object extract()
extract
in class SemaphoreControlledChannel
public java.lang.Object peek()
Channel
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |