org.jikesrvm.adaptive.util
Class BlockingPriorityQueue
java.lang.Object
org.jikesrvm.util.PriorityQueueRVM
org.jikesrvm.adaptive.util.BlockingPriorityQueue
public class BlockingPriorityQueue
- extends PriorityQueueRVM
This class extends PriorityQueueRVM to safely
support multiple producers/consumers where
the consumers are blocked if no objects are available
to consume.
|
Nested Class Summary |
static class |
BlockingPriorityQueue.CallBack
Used to notify consumers when about to wait and when notified
Default implementation does nothing, but can be overriden as needed by client. |
|
Method Summary |
Object |
deleteMin()
Remove and return the front (minimum) object. |
void |
insert(double _priority,
Object _data)
Insert the object passed with the priority value passed
Notify any sleeping consumer threads that an object
is available for consumption. |
callback
BlockingPriorityQueue.CallBack callback
BlockingPriorityQueue
public BlockingPriorityQueue(BlockingPriorityQueue.CallBack _cb)
- Parameters:
_cb - the callback object
BlockingPriorityQueue
public BlockingPriorityQueue()
insert
public final void insert(double _priority,
Object _data)
- Insert the object passed with the priority value passed
Notify any sleeping consumer threads that an object
is available for consumption.
- Overrides:
insert in class PriorityQueueRVM
- Parameters:
_priority - the priority to_data - the object to insert
deleteMin
public final Object deleteMin()
- Remove and return the front (minimum) object. If the queue is currently
empty, then block until an object is available to be dequeued.
- Overrides:
deleteMin in class PriorityQueueRVM
- Returns:
- the front (minimum) object.