public class RequestQueue
extends java.lang.Object
RequestDispatcher
thead to be processed.
NOTE:
Implementing of different kinds of priorities is very easy.
Using several queues with differents priorities and then doing the
necessary changes in the add and get methods.
Usage example:
construct
add
get
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<RequestQueueNode> |
queue
Contains a list of the client request.
|
Constructor and Description |
---|
RequestQueue()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(RequestQueueNode nodeInfo)
Adds new client request nodes to the queue, and it notifies it to the
dispatcher requests.
|
RequestQueueNode |
get()
Returns the first element of the queue if it isn't empty, otherwise null.
|
boolean |
isEmpty()
Returns true if the list is empty, false otherwise.
|
void |
list(java.io.PrintStream out)
Prints this Request Queue fields out to the specified output stream.
|
int |
size()
Returns the size of the queue.
|
java.lang.String |
toString() |
private java.util.ArrayList<RequestQueueNode> queue
public void add(RequestQueueNode nodeInfo)
nodeInfo
- public RequestQueueNode get() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean isEmpty()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)