public class ClientCallback extends Object implements Future<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 Map<String,Object> |
context |
protected boolean |
done |
protected Throwable |
exception |
protected Object[] |
result |
protected boolean |
started |
Constructor and Description |
---|
ClientCallback() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
Object[] |
get() |
Object[] |
get(long timeout,
TimeUnit unit) |
Throwable |
getException() |
Map<String,Object> |
getResponseContext()
return the map of items returned from an operation.
|
void |
handleException(Map<String,Object> ctx,
Throwable ex)
If processing of the incoming message results in an exception, this
method is called with the resulting exception.
|
void |
handleResponse(Map<String,Object> ctx,
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 Object[] result
protected Throwable exception
protected volatile boolean done
protected boolean cancelled
protected boolean started
public void start(Message msg)
public void handleResponse(Map<String,Object> ctx, Object[] res)
ctx
- res
- public void handleException(Map<String,Object> ctx, Throwable ex)
ctx
- ex
- public boolean cancel(boolean mayInterruptIfRunning)
public Map<String,Object> getResponseContext() throws InterruptedException, ExecutionException
InterruptedException
- if the operation was cancelled.ExecutionException
- if the operation resulted in a fault.public Object[] get() throws InterruptedException, ExecutionException
get
in interface Future<Object[]>
InterruptedException
ExecutionException
public Object[] get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<Object[]>
InterruptedException
ExecutionException
TimeoutException
public boolean isCancelled()
isCancelled
in interface Future<Object[]>
public Throwable getException()
Copyright © 2016 JBoss by Red Hat. All rights reserved.