public final class TaskQueue<E> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
TaskQueue.MutableMaxQueueSize |
Modifier and Type | Field and Description |
---|---|
protected Queue<WriteHandler> |
writeHandlersQueue |
Modifier | Constructor and Description |
---|---|
protected |
TaskQueue(TaskQueue.MutableMaxQueueSize maxQueueSizeHolder) |
Modifier and Type | Method and Description |
---|---|
static <E> TaskQueue<E> |
createTaskQueue(TaskQueue.MutableMaxQueueSize maxQueueSizeHolder) |
void |
doNotify() |
boolean |
forgetWritePossible(WriteHandler writeHandler) |
Queue<E> |
getQueue()
Get the queue of tasks, which will be processed asynchronously
|
boolean |
isEmpty() |
void |
notifyWritePossible(WriteHandler writeHandler) |
void |
notifyWritePossible(WriteHandler writeHandler,
int size)
Deprecated.
|
E |
obtainCurrentElement()
Get the current processing task, if the current in not set, take the
task from the queue.
|
E |
obtainCurrentElementAndReserve()
Gets the current processing task and reserves its place.
|
void |
offer(E task)
Add the new task into the task queue.
|
void |
onClose() |
int |
releaseSpace(int amount)
Releases memory space in the queue.
|
int |
releaseSpaceAndNotify(int amount)
Releases memory space in the queue and notifies registered
QueueMonitor s about the update. |
boolean |
remove(E task)
Remove the task from queue.
|
int |
reserveSpace(int amount)
Reserves memory space in the queue.
|
void |
setCurrentElement(E task)
Set current task element.
|
int |
spaceInBytes()
Returns the number of queued bytes.
|
protected final Queue<WriteHandler> writeHandlersQueue
protected TaskQueue(TaskQueue.MutableMaxQueueSize maxQueueSizeHolder)
public static <E> TaskQueue<E> createTaskQueue(TaskQueue.MutableMaxQueueSize maxQueueSizeHolder)
public int reserveSpace(int amount)
public int releaseSpace(int amount)
public int releaseSpaceAndNotify(int amount)
QueueMonitor
s about the update.public int spaceInBytes()
public E obtainCurrentElement()
public E obtainCurrentElementAndReserve()
public Queue<E> getQueue()
@Deprecated public void notifyWritePossible(WriteHandler writeHandler, int size)
public void notifyWritePossible(WriteHandler writeHandler)
public final boolean forgetWritePossible(WriteHandler writeHandler)
public void doNotify()
public void setCurrentElement(E task)
task
- current element.public boolean remove(E task)
task
- the task to remove.public void offer(E task)
task
- new task.public boolean isEmpty()
public void onClose()
Copyright © 2013 Oracle Corporation. All Rights Reserved.