Package org.apache.cxf.endpoint
Class ClientCallback
- java.lang.Object
-
- org.apache.cxf.endpoint.ClientCallback
-
public class ClientCallback extends Object implements Future<Object[]>
Asynchronous callback object for calls toClient.invoke(ClientCallback, String, Object...)
and related functions. The default behavior of this expects the following pattern:- ClientCallback cb = new ClientCallback();<>
- client.invoke(cb, "someMethod", ....);
- cb.wait();
- // CXF calls notify on the callback object when the operation is complete.
-
-
Constructor Summary
Constructors Constructor Description ClientCallback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancel(boolean mayInterruptIfRunning)
Object[]
get()
Object[]
get(long timeout, TimeUnit unit)
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.
-
-
-
Field Detail
-
delegate
protected final CompletableFuture<Object[]> delegate
-
started
protected boolean started
-
-
Method Detail
-
start
public void start(Message msg)
Called when a message is first received prior to any actions being applied to the message. The InterceptorChain is setup so modifications to that can be done.
-
handleResponse
public 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. The default behavior just stores the objects and calls notifyAll to wake up threads waiting for the response.- Parameters:
ctx
-res
-
-
handleException
public 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. The default behavior just stores the objects and calls notifyAll to wake up threads waiting for the response.- Parameters:
ctx
-ex
-
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
getResponseContext
public Map<String,Object> getResponseContext() throws InterruptedException, ExecutionException
return the map of items returned from an operation.- Returns:
- the response context
- Throws:
InterruptedException
- if the operation was cancelled.ExecutionException
- if the operation resulted in a fault.
-
get
public Object[] get() throws InterruptedException, ExecutionException
- Specified by:
get
in interfaceFuture<Object[]>
- Throws:
InterruptedException
ExecutionException
-
get
public Object[] get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
get
in interfaceFuture<Object[]>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfaceFuture<Object[]>
-
-