public class ProducerConsumerQueue extends Object
Constructor and Description |
---|
ProducerConsumerQueue()
Create a new instance of a PC Queue
|
Modifier and Type | Method and Description |
---|---|
void |
addFirst(Object o)
Add a new object to the queue (Produce).
|
void |
addPriority(Object o)
Add a new object to the queue giving it priorty.
|
boolean |
hasWaiters()
Returns true if there are Consumer threads waiting for objects.
|
Object |
removeLast()
Remove an object from the queue (Consume).
|
Object |
removeLast(long maxTime)
Remove an object from the queue (Consume).
|
int |
size()
Returns the number of objects on the PCQueue.
|
public ProducerConsumerQueue()
public void addFirst(Object o)
o
- Object to add to the queuepublic void addPriority(Object o)
o
- Object to add to the queuepublic Object removeLast()
public Object removeLast(long maxTime)
maxTime
- THe maximum time to wait for an Object in millisecondspublic boolean hasWaiters()
public int size()
Copyright © 2003, 2023, Oracle and/or its affiliates.