public class ClientCallback
extends java.lang.Object
implements java.util.concurrent.Future<java.lang.Object[]>
Client.invoke(ClientCallback, String, Object...)
and related functions.
The default behavior of this expects the following pattern:
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
cancelled |
protected java.util.Map<java.lang.String,java.lang.Object> |
context |
protected boolean |
done |
protected java.lang.Throwable |
exception |
protected java.lang.Object[] |
result |
protected boolean |
started |
| Constructor and Description |
|---|
ClientCallback() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
java.lang.Object[] |
get() |
java.lang.Object[] |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
java.lang.Throwable |
getException() |
java.util.Map<java.lang.String,java.lang.Object> |
getResponseContext()
return the map of items returned from an operation.
|
void |
handleException(java.util.Map<java.lang.String,java.lang.Object> ctx,
java.lang.Throwable ex)
If processing of the incoming message results in an exception, this
method is called with the resulting exception.
|
void |
handleResponse(java.util.Map<java.lang.String,java.lang.Object> ctx,
java.lang.Object[] res)
If the processing of the incoming message proceeds normally, this
method is called with the response context values and the resulting objects.
|
boolean |
isCancelled() |
boolean |
isDone() |
void |
start(Message msg)
Called when a message is first received prior to any actions
being applied to the message.
|
protected java.util.Map<java.lang.String,java.lang.Object> context
protected java.lang.Object[] result
protected java.lang.Throwable exception
protected volatile boolean done
protected boolean cancelled
protected boolean started
public void start(Message msg)
public void handleResponse(java.util.Map<java.lang.String,java.lang.Object> ctx,
java.lang.Object[] res)
ctx - res - public void handleException(java.util.Map<java.lang.String,java.lang.Object> ctx,
java.lang.Throwable ex)
ctx - ex - public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<java.lang.Object[]>public java.util.Map<java.lang.String,java.lang.Object> getResponseContext()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
java.lang.InterruptedException - if the operation was cancelled.java.util.concurrent.ExecutionException - if the operation resulted in a fault.public java.lang.Object[] get()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<java.lang.Object[]>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic java.lang.Object[] get(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
get in interface java.util.concurrent.Future<java.lang.Object[]>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<java.lang.Object[]>public boolean isDone()
isDone in interface java.util.concurrent.Future<java.lang.Object[]>public java.lang.Throwable getException()