class WebCallableClient extends java.lang.Object implements CallableClient
Modifier and Type | Field and Description |
---|---|
private int |
capacity_ |
static int |
DEFAULT_CAPACITY
Default maximum for queued callbacks.
|
private boolean |
ended_ |
private java.util.List |
queue_ |
Constructor and Description |
---|
WebCallableClient()
Constructs a callable client with default maximum capacity.
|
WebCallableClient(int capacity)
Constructs a callable client with a given maximum callback capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
endCallbacks()
Informs this client that no further callbacks (receive* methods)
will be made on it.
|
private void |
enqueue(java.lang.String methodName,
java.lang.Object[] params)
Adds a new callback to the queue which can be passed out via the
pullCallbacks(int) method. |
java.util.List |
pullCallbacks(int timeout)
Blocks for up to a given number of seconds or until any callbacks
are ready, then returns any ready callbacks.
|
void |
receiveCall(java.lang.String senderId,
java.lang.String msgId,
Message message)
Receives a message for which a response is required.
|
void |
receiveNotification(java.lang.String senderId,
Message message)
Receives a message for which no response is required.
|
void |
receiveResponse(java.lang.String responderId,
java.lang.String msgTag,
Response response)
Receives a response to a message previously sent by this client.
|
private final java.util.List queue_
private final int capacity_
private boolean ended_
public static final int DEFAULT_CAPACITY
public WebCallableClient()
public WebCallableClient(int capacity)
capacity
- maximum number of queued callbackspublic java.util.List pullCallbacks(int timeout) throws SampException
timeout
- timeout in secondsCallback
-like MapsSampException
public void receiveNotification(java.lang.String senderId, Message message)
CallableClient
receiveNotification
in interface CallableClient
senderId
- public ID of sending clientmessage
- messagepublic void receiveCall(java.lang.String senderId, java.lang.String msgId, Message message)
CallableClient
reply
method at some future point.receiveCall
in interface CallableClient
senderId
- public ID of sending clientmsgId
- message identifier for later use with replymessage
- messagepublic void receiveResponse(java.lang.String responderId, java.lang.String msgTag, Response response)
CallableClient
receiveResponse
in interface CallableClient
responderId
- public ID of responding clientmsgTag
- client-defined tag labelling previously-sent messageresponse
- returned response objectpublic void endCallbacks()
private void enqueue(java.lang.String methodName, java.lang.Object[] params)
pullCallbacks(int)
method.methodName
- callback method nameparams
- callback parameter list