|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.service.io.QueueManager
public class QueueManager
A facade class used for adding and removing from the request and response queues. The methods used in this class are thread safe and should be used instead of using the queues directly.
Nested Class Summary | |
---|---|
private static class |
QueueManager.QueueManagerHolder
Use Initialization on demand holder pattern |
Field Summary | |
---|---|
java.lang.Object |
lock
|
private RequestQueue |
mRequestQueue
|
private ResponseQueue |
mResponseQueue
|
Constructor Summary | |
---|---|
private |
QueueManager()
|
Method Summary | |
---|---|
void |
addQueueListener(IQueueListener listener)
Adds a listener listening for RequestQueue changes. |
int |
addRequest(Request request)
Adds a request to the queue without sending an event to the listeners |
int[] |
addRequest(Request[] requests)
Adds requests to the queue. |
int |
addRequestAndNotify(Request request)
Add request to queue and notify the queue listener. |
void |
addResponse(ResponseQueue.Response response)
Adds a response to the response queue. |
void |
clearActiveRequests(boolean rpgOnly)
Clear active requests (i.e add dummy response to response queue). |
void |
clearAllRequests()
Clears all requests from the request queue and puts null responses on the response queue to tell the engines that they have been cleared. |
void |
clearRequestTimeouts()
Clears all request timeouts that were added to the timeout watcher. |
void |
fireQueueStateChanged()
Fire a manual queue state changed event to notify the queue listener that a request is on the request queue. |
java.util.List<Request> |
getAllRequests()
Returns all requests from the queue. |
java.util.List<Request> |
getApiRequests()
Returns all requests from the queue needing the API or both to work. |
static QueueManager |
getInstance()
Returns a single instance of the RequestResponseManager which holds the request and response queues. |
Request |
getRequest(int requestId)
Return Request from specified request ID. |
TimeOutWatcher |
getRequestTimeoutWatcher()
Returns a timeout-watcher of requests from the request queue. |
java.util.List<Request> |
getRpgRequests()
Returns all requests from the queue needing the RPG or both to work. |
void |
removeQueueListener(IQueueListener listener)
Remove RequestQueue listener from the list. |
boolean |
removeRequest(int requestId)
Removes the request for the given request ID from the queue and searches the queue for requests older than Settings.REMOVE_REQUEST_FROM_QUEUE_MILLIS and removes them as well. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.Object lock
private RequestQueue mRequestQueue
private ResponseQueue mResponseQueue
Constructor Detail |
---|
private QueueManager()
Method Detail |
---|
public static QueueManager getInstance()
public void addResponse(ResponseQueue.Response response)
response
- The response to add to the queue.public void clearRequestTimeouts()
public TimeOutWatcher getRequestTimeoutWatcher()
public void clearAllRequests()
public void clearActiveRequests(boolean rpgOnly)
rpgOnly
- If true only RPG requests will be cleared.public boolean removeRequest(int requestId)
requestId
- The ID of the request to remove.
public Request getRequest(int requestId)
requestId
- Request Id of required request
public java.util.List<Request> getApiRequests()
public java.util.List<Request> getRpgRequests()
public java.util.List<Request> getAllRequests()
public int[] addRequest(Request[] requests)
requests
- The requests to add.
public int addRequest(Request request)
request
- The request to add
public int addRequestAndNotify(Request request)
request
- The request to add to the queue.
public void fireQueueStateChanged()
public void addQueueListener(IQueueListener listener)
listener
- Listener to add to the list of request queue listeners.public void removeQueueListener(IQueueListener listener)
listener
- The listener to remove.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc