public class ProducerConsumerQueue<T> extends Object
| Constructor and Description |
|---|
ProducerConsumerQueue(int producersToWaitFor) |
ProducerConsumerQueue(int queueLenght,
int producersToWaitFor) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public ProducerConsumerQueue(int producersToWaitFor)
producersToWaitFor - The number of producer threads.public ProducerConsumerQueue(int queueLenght,
int producersToWaitFor)
public T take() throws InterruptedException
InterruptedExceptionpublic void put(T obj) throws InterruptedException
obj - InterruptedExceptionpublic void producerStopping()
Copyright © 2018 JBoss by Red Hat. All rights reserved.