com.almende.eve.transport
Class AsyncCallbackQueue<T>

java.lang.Object
  extended by com.almende.eve.transport.AsyncCallbackQueue<T>

public class AsyncCallbackQueue<T>
extends Object

Queue to hold a list with callbacks in progress. The Queue handles timeouts on the callbacks.


Constructor Summary
AsyncCallbackQueue()
           
 
Method Summary
 void clear()
          Remove all callbacks from the queue.
 AsyncCallback<T> pull(String id)
          Pull a callback from the queue.
 void push(String id, AsyncCallback<T> callback)
          Append a callback to the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncCallbackQueue

public AsyncCallbackQueue()
Method Detail

push

public void push(String id,
                 AsyncCallback<T> callback)
          throws Exception
Append a callback to the queue. The callback must be pulled from the queue again within the timeout. If not, the callback.onFailure will be called with a TimeoutException as argument, and is deleted from the queue. The method will throw an exception when a callback with the same id is already in the queue.

Parameters:
id -
callback -
Throws:
Exception

pull

public AsyncCallback<T> pull(String id)
Pull a callback from the queue. The callback can be pulled from the queue only once. If no callback is found with given id, null will be returned.

Parameters:
id -
Returns:

clear

public void clear()
Remove all callbacks from the queue.



Copyright © 2013 Almende BV. All Rights Reserved.