|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.search.batchindexing.impl.ProducerConsumerQueue<T>
public class ProducerConsumerQueue<T>
Implements a blocking queue capable of storing a "poison" token to signal consumer threads that the task is finished.
| Constructor Summary | |
|---|---|
ProducerConsumerQueue(int producersToWaitFor)
|
|
ProducerConsumerQueue(int queueLenght,
int producersToWaitFor)
|
|
| Method Summary | |
|---|---|
void |
producerStopping()
Each producer thread should call producerStopping() when it has finished. |
void |
put(T obj)
Adds a new object to the queue, blocking if no space is available. |
T |
take()
Blocks until an object is available; when null is returned the client thread should quit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProducerConsumerQueue(int producersToWaitFor)
producersToWaitFor - The number of producer threads.
public ProducerConsumerQueue(int queueLenght,
int producersToWaitFor)
| Method Detail |
|---|
public T take()
throws InterruptedException
InterruptedException
public void put(T obj)
throws InterruptedException
obj -
InterruptedExceptionpublic void producerStopping()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||