com.caucho.bam.query
Class QueryManager

java.lang.Object
  extended by com.caucho.bam.query.QueryManager

public class QueryManager
extends java.lang.Object

QueryCallbackManager is used to generate query ids and to wait for query callbacks.


Constructor Summary
QueryManager()
           
QueryManager(long seed)
           
 
Method Summary
 void addQueryCallback(long id, QueryCallback callback, long timeout)
          Adds a query callback to handle a later message.
 QueryFuture addQueryFuture(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, long timeout)
          Registers a callback future.
 void close()
           
 long getTimeout()
           
 boolean isEmpty()
           
 long nextQueryId()
          Generates a new unique query identifier.
 boolean onQueryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Callback from the ActorStream to handle a queryResult.
 boolean onQueryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Callback from the ActorStream to handle a queryResult.
 void setTimeout(long timeout)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryManager

public QueryManager()

QueryManager

public QueryManager(long seed)
Method Detail

isEmpty

public boolean isEmpty()

getTimeout

public long getTimeout()

setTimeout

public void setTimeout(long timeout)

nextQueryId

public final long nextQueryId()
Generates a new unique query identifier.


addQueryCallback

public void addQueryCallback(long id,
                             QueryCallback callback,
                             long timeout)
Adds a query callback to handle a later message.

Parameters:
id - the unique query identifier
callback - the application's callback for the result

addQueryFuture

public QueryFuture addQueryFuture(long id,
                                  java.lang.String to,
                                  java.lang.String from,
                                  java.io.Serializable payload,
                                  long timeout)
Registers a callback future.


onQueryResult

public final boolean onQueryResult(long id,
                                   java.lang.String to,
                                   java.lang.String from,
                                   java.io.Serializable payload)
Callback from the ActorStream to handle a queryResult. Returns true if the client has a pending query, false otherwise.


onQueryError

public final boolean onQueryError(long id,
                                  java.lang.String to,
                                  java.lang.String from,
                                  java.io.Serializable payload,
                                  BamError error)
Callback from the ActorStream to handle a queryResult. Returns true if the client has a pending query, false otherwise.


close

public void close()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object