|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.asyncqueue.TaskQueue<E>
public final class TaskQueue<E>
Class represents common implementation of asynchronous processing queue.
| Nested Class Summary | |
|---|---|
static class |
TaskQueue.QueueMonitor
Notification mechanism which will be invoked when releaseSpace(int) or releaseSpaceAndNotify(int)
is called. |
| Field Summary | |
|---|---|
protected java.util.Queue<TaskQueue.QueueMonitor> |
monitorQueue
|
| Constructor Summary | |
|---|---|
protected |
TaskQueue()
|
| Method Summary | ||
|---|---|---|
boolean |
addQueueMonitor(TaskQueue.QueueMonitor monitor)
Get the queue of tasks, which will be processed asynchronously |
|
static
|
createTaskQueue()
|
|
protected void |
doNotify()
|
|
boolean |
isEmpty()
|
|
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. |
|
int |
releaseSpace(int amount)
Releases memory space in the queue. |
|
int |
releaseSpaceAndNotify(int amount)
Releases memory space in the queue and notifies registered TaskQueue.QueueMonitors about the update. |
|
boolean |
remove(E task)
Remove the task from queue. |
|
void |
removeQueueMonitor(TaskQueue.QueueMonitor monitor)
|
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.Queue<TaskQueue.QueueMonitor> monitorQueue
| Constructor Detail |
|---|
protected TaskQueue()
| Method Detail |
|---|
public static <E> TaskQueue<E> createTaskQueue()
public int reserveSpace(int amount)
public int releaseSpace(int amount)
public int releaseSpaceAndNotify(int amount)
throws java.io.IOException
TaskQueue.QueueMonitors about the update.
java.io.IOExceptionpublic int spaceInBytes()
public E obtainCurrentElement()
public E obtainCurrentElementAndReserve()
public boolean addQueueMonitor(TaskQueue.QueueMonitor monitor)
throws java.io.IOException
java.io.IOExceptionpublic void removeQueueMonitor(TaskQueue.QueueMonitor monitor)
protected void doNotify()
throws java.io.IOException
java.io.IOExceptionpublic 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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||