T
- - The type of Task
. The full type parameter in the interface's signature
is:<T extends Task
<? extends Object
>>
.public interface TaskQueue<T extends Task<? extends Object>>
Task
s placed into a custom
queue which can be operated by producers or consumers in one or more Thread
.Modifier and Type | Method and Description |
---|---|
T |
dequeue()
Removes an element from the tail of the queue and returns it.
|
void |
enqueue(T task)
Adds an element to the head of the queue.
|
void enqueue(T task) throws InterruptedException
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
.T dequeue() throws InterruptedException
Thread
is blocked until a Task
is added to the queue
and it is no longer empty.Task
which is being removed from 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.