public class UnboundedTaskQueue extends AbstractBlockingTaskQueue
BoundedTaskQueue
is an unordered, unbounded implementation of a TaskQueue
.
This implementation is ThreadSafe
, as it can safely handle multiple consumer
and producer threads writing and/or reading from it.queue
Constructor and Description |
---|
UnboundedTaskQueue() |
Modifier and Type | Method and Description |
---|---|
void |
enqueue(Task<? extends Object> task)
Adds an element to the head of the queue.
|
dequeue
public void enqueue(Task<? extends Object> task) throws InterruptedException
TaskQueue
Thread
is blocked until capacity in the queue has been released.task
- - The Task
which is being added to the queue.InterruptedException
- - The method hands off the responsibility of exception handling to the caller in
event of an interruption in the Thread
.Copyright © 2020. All rights reserved.