public class ClientImpl extends AbstractBasicInterceptorProvider implements Client, Retryable, MessageObserver
| Modifier and Type | Class and Description |
|---|---|
class |
ClientImpl.EchoContext |
class |
ClientImpl.IllegalEmptyResponseException |
Client.Contexts| Modifier and Type | Field and Description |
|---|---|
protected Bus |
bus |
protected ConduitSelector |
conduitSelector |
protected java.util.Map<java.lang.String,java.lang.Object> |
currentRequestContext |
protected java.util.concurrent.Executor |
executor |
static java.lang.String |
FINISHED |
protected PhaseChainCache |
inboundChainCache |
protected java.lang.Thread |
latestContextThread |
protected PhaseChainCache |
outboundChainCache |
protected ClientOutFaultObserver |
outFaultObserver |
protected java.util.Map<java.lang.Thread,ClientImpl.EchoContext> |
requestContext |
protected java.util.Map<java.lang.Thread,org.apache.cxf.endpoint.ClientImpl.ResponseContext> |
responseContext |
static java.lang.String |
SYNC_TIMEOUT
When a synchronous request/response invoke is done using an asynchronous transport mechanism,
this is the timeout used for waiting for the response.
|
protected int |
synchronousTimeout |
static java.lang.String |
THREAD_LOCAL_REQUEST_CONTEXT |
KEEP_CONDUIT_ALIVE, REQUEST_CONTEXT, RESPONSE_CONTEXT| Constructor and Description |
|---|
ClientImpl(Bus b,
Endpoint e) |
ClientImpl(Bus b,
Endpoint e,
Conduit c) |
ClientImpl(Bus b,
Endpoint e,
ConduitSelector sc) |
ClientImpl(Bus bus,
Service svc,
QName port,
EndpointImplFactory endpointImplFactory)
Create a Client that uses a specific EndpointImpl.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
destroy()
Indicates that the client is no longer needed and that any resources it holds
can now be freed.
|
Bus |
getBus()
Retrieves the Bus that was used to create the Client
|
Conduit |
getConduit()
Get the Conduit that messages for this client will be sent on.
|
ConduitSelector |
getConduitSelector()
Get the ConduitSelector responsible for retreiving the Conduit.
|
protected ConduitSelector |
getConduitSelector(ConduitSelector override) |
Client.Contexts |
getContexts() |
Endpoint |
getEndpoint() |
protected java.lang.Exception |
getException(Exchange exchange) |
java.util.Map<java.lang.String,java.lang.Object> |
getRequestContext()
Gets the request context used for future invocations
|
java.util.Map<java.lang.String,java.lang.Object> |
getResponseContext()
Gets the response context from the last invocation on this thread
|
int |
getSynchronousTimeout() |
java.lang.Object[] |
invoke(BindingOperationInfo oi,
java.lang.Object... params)
Invokes an operation synchronously
|
java.lang.Object[] |
invoke(BindingOperationInfo oi,
java.lang.Object[] params,
Exchange exchange) |
java.lang.Object[] |
invoke(BindingOperationInfo oi,
java.lang.Object[] params,
java.util.Map<java.lang.String,java.lang.Object> context)
Invokes an operation synchronously
|
java.lang.Object[] |
invoke(BindingOperationInfo oi,
java.lang.Object[] params,
java.util.Map<java.lang.String,java.lang.Object> context,
Exchange exchange)
Invokes an operation synchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
java.lang.Object... params)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
java.lang.Object[] params,
Exchange exchange)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
java.lang.Object[] params,
java.util.Map<java.lang.String,java.lang.Object> context)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
java.lang.Object[] params,
java.util.Map<java.lang.String,java.lang.Object> context,
Exchange exchange)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
QName operationName,
java.lang.Object... params)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
java.lang.String operationName,
java.lang.Object... params)
Invokes an operation asynchronously
|
java.lang.Object[] |
invoke(QName operationName,
java.lang.Object... params)
Invokes an operation synchronously
|
java.lang.Object[] |
invoke(java.lang.String operationName,
java.lang.Object... params)
Invokes an operation synchronously
|
void |
invokeWrapped(ClientCallback callback,
QName operationName,
java.lang.Object... params)
Invokes an operation asynchronously
|
void |
invokeWrapped(ClientCallback callback,
java.lang.String operationName,
java.lang.Object... params)
Invokes an operation asynchronously
|
java.lang.Object[] |
invokeWrapped(QName operationName,
java.lang.Object... params)
Invokes an operation synchronously
|
java.lang.Object[] |
invokeWrapped(java.lang.String operationName,
java.lang.Object... params)
Invokes an operation synchronously
|
boolean |
isThreadLocalRequestContext()
Checks if the Request context is thread local or global.
|
protected void |
modifyChain(InterceptorChain chain,
Message ctx,
boolean in) |
void |
onMessage(Message message)
Called for an incoming message, i.e.
|
protected void |
prepareConduitSelector(Message message) |
protected java.lang.Object[] |
processResult(Message message,
Exchange exchange,
BindingOperationInfo oi,
java.util.Map<java.lang.String,java.lang.Object> resContext) |
void |
releaseThreadContexts() |
void |
setConduitSelector(ConduitSelector selector)
Set the ConduitSelector responsible for retreiving the Conduit.
|
protected void |
setContext(java.util.Map<java.lang.String,java.lang.Object> ctx,
Message message) |
protected void |
setEndpoint(Endpoint e) |
protected void |
setExchangeProperties(Exchange exchange,
Endpoint endpoint,
BindingOperationInfo boi) |
void |
setExecutor(java.util.concurrent.Executor executor)
Sets the executor which is used to process Asynchronous responses.
|
protected void |
setOutMessageProperties(Message message,
BindingOperationInfo boi) |
protected void |
setParameters(java.lang.Object[] params,
Message message) |
protected java.util.Map<java.lang.String,java.lang.Object> |
setResponseContext(java.util.Map<java.lang.String,java.lang.Object> ctx) |
void |
setSynchronousTimeout(int synchronousTimeout) |
void |
setThreadLocalRequestContext(boolean b)
Sets whether the request context is thread local or global to this client.
|
protected PhaseInterceptorChain |
setupInterceptorChain(Endpoint endpoint) |
protected void |
waitResponse(Exchange exchange) |
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptorsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptorspublic static final java.lang.String THREAD_LOCAL_REQUEST_CONTEXT
public static final java.lang.String SYNC_TIMEOUT
public static final java.lang.String FINISHED
protected Bus bus
protected ConduitSelector conduitSelector
protected ClientOutFaultObserver outFaultObserver
protected int synchronousTimeout
protected PhaseChainCache outboundChainCache
protected PhaseChainCache inboundChainCache
protected java.util.Map<java.lang.String,java.lang.Object> currentRequestContext
protected java.lang.Thread latestContextThread
protected java.util.Map<java.lang.Thread,ClientImpl.EchoContext> requestContext
protected java.util.Map<java.lang.Thread,org.apache.cxf.endpoint.ClientImpl.ResponseContext> responseContext
protected java.util.concurrent.Executor executor
public ClientImpl(Bus b, Endpoint e, ConduitSelector sc)
public ClientImpl(Bus bus, Service svc, QName port, EndpointImplFactory endpointImplFactory)
bus - svc - port - endpointImplFactory - public Bus getBus()
Clientpublic void destroy()
Clientpublic Endpoint getEndpoint()
getEndpoint in interface Clientpublic void releaseThreadContexts()
public Client.Contexts getContexts()
getContexts in interface Clientpublic java.util.Map<java.lang.String,java.lang.Object> getRequestContext()
ClientgetRequestContext in interface Clientpublic java.util.Map<java.lang.String,java.lang.Object> getResponseContext()
ClientgetResponseContext in interface Clientprotected java.util.Map<java.lang.String,java.lang.Object> setResponseContext(java.util.Map<java.lang.String,java.lang.Object> ctx)
public boolean isThreadLocalRequestContext()
ClientisThreadLocalRequestContext in interface Clientpublic void setThreadLocalRequestContext(boolean b)
ClientsetThreadLocalRequestContext in interface Clientpublic java.lang.Object[] invoke(BindingOperationInfo oi, java.lang.Object... params) throws java.lang.Exception
Clientpublic java.lang.Object[] invoke(java.lang.String operationName,
java.lang.Object... params)
throws java.lang.Exception
Clientinvoke in interface ClientoperationName - The name of the operation to be invoked. The service namespace will be used
when looking up the BindingOperationInfo.params - The params that matches the parts of the input message of the operation. If the
BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If
params are in the wrapped form, use invokeWrappedjava.lang.Exceptionpublic java.lang.Object[] invoke(QName operationName, java.lang.Object... params) throws java.lang.Exception
Clientinvoke in interface ClientoperationName - The name of the operation to be invokedparams - The params that matches the parts of the input message of the operation. If the
BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If
params are in the wrapped form, use invokeWrappedjava.lang.Exceptionpublic java.lang.Object[] invokeWrapped(java.lang.String operationName,
java.lang.Object... params)
throws java.lang.Exception
ClientinvokeWrapped in interface ClientoperationName - The name of the operation to be invoked. The service namespace will be used
when looking up the BindingOperationInfo.params - The params that matches the parts of the input message of the operationjava.lang.Exceptionpublic java.lang.Object[] invokeWrapped(QName operationName, java.lang.Object... params) throws java.lang.Exception
ClientinvokeWrapped in interface ClientoperationName - The name of the operation to be invokedparams - The params that matches the parts of the input message of the operationjava.lang.Exceptionpublic java.lang.Object[] invoke(BindingOperationInfo oi, java.lang.Object[] params, Exchange exchange) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Object[] invoke(BindingOperationInfo oi, java.lang.Object[] params, java.util.Map<java.lang.String,java.lang.Object> context) throws java.lang.Exception
Clientinvoke in interface Clientoi - The operation to be invokedparams - The params that matches the parts of the input message of the operationcontext - Optional (can be null) contextual information for the invocationjava.lang.Exceptionpublic void invoke(ClientCallback callback, java.lang.String operationName, java.lang.Object... params) throws java.lang.Exception
Clientinvoke in interface Clientcallback - The callback that is called when the response is readyoperationName - The name of the operation to be invoked. The service namespace will be used
when looking up the BindingOperationInfo.params - The params that matches the parts of the input message of the operation. If the
BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If
params are in the wrapped form, use invokeWrappedjava.lang.Exceptionpublic void invoke(ClientCallback callback, QName operationName, java.lang.Object... params) throws java.lang.Exception
Clientinvoke in interface Clientcallback - The callback that is called when the response is readyoperationName - The name of the operation to be invokedparams - The params that matches the parts of the input message of the operation. If the
BindingOperationInfo supports unwrapping, it assumes the params are in the "unwrapped" form. If
params are in the wrapped form, use invokeWrappedjava.lang.Exceptionpublic void invokeWrapped(ClientCallback callback, java.lang.String operationName, java.lang.Object... params) throws java.lang.Exception
ClientinvokeWrapped in interface Clientcallback - The callback that is called when the response is readyoperationName - The name of the operation to be invoked. The service namespace will be used
when looking up the BindingOperationInfo.params - The params that matches the parts of the input message of the operationjava.lang.Exceptionpublic void invokeWrapped(ClientCallback callback, QName operationName, java.lang.Object... params) throws java.lang.Exception
ClientinvokeWrapped in interface Clientcallback - The callback that is called when the response is readyoperationName - The name of the operation to be invokedparams - The params that matches the parts of the input message of the operationjava.lang.Exceptionpublic void invoke(ClientCallback callback, BindingOperationInfo oi, java.lang.Object... params) throws java.lang.Exception
Clientpublic void invoke(ClientCallback callback, BindingOperationInfo oi, java.lang.Object[] params, java.util.Map<java.lang.String,java.lang.Object> context) throws java.lang.Exception
Clientinvoke in interface Clientcallback - The callback that is called when the response is readyoi - The operation to be invokedparams - The params that matches the parts of the input message of the operationcontext - contextual information for the invocationjava.lang.Exceptionpublic void invoke(ClientCallback callback, BindingOperationInfo oi, java.lang.Object[] params, Exchange exchange) throws java.lang.Exception
Clientinvoke in interface Clientcallback - The callback that is called when the response is readyoi - The operation to be invokedparams - The params that matches the parts of the input message of the operationexchange - The Exchange to be used for the invocationjava.lang.Exceptionpublic void invoke(ClientCallback callback, BindingOperationInfo oi, java.lang.Object[] params, java.util.Map<java.lang.String,java.lang.Object> context, Exchange exchange) throws java.lang.Exception
Clientinvoke in interface Clientcallback - The callback that is called when the response is readyoi - The operation to be invokedparams - The params that matches the parts of the input message of the operationcontext - Optional (can be null) contextual information for the invocationexchange - Optional (can be null) The Exchange to be used for the invocationjava.lang.Exceptionpublic java.lang.Object[] invoke(BindingOperationInfo oi, java.lang.Object[] params, java.util.Map<java.lang.String,java.lang.Object> context, Exchange exchange) throws java.lang.Exception
Clientinvoke in interface Clientinvoke in interface Retryableoi - The operation to be invokedparams - The params that matches the parts of the input message of the operationcontext - Optional (can be null) contextual information for the invocationexchange - The Exchange to be used for the invocationjava.lang.Exceptionprotected java.lang.Object[] processResult(Message message, Exchange exchange, BindingOperationInfo oi, java.util.Map<java.lang.String,java.lang.Object> resContext) throws java.lang.Exception
java.lang.Exceptionprotected java.lang.Exception getException(Exchange exchange)
protected void setContext(java.util.Map<java.lang.String,java.lang.Object> ctx,
Message message)
protected void waitResponse(Exchange exchange) throws java.io.IOException
java.io.IOExceptionprotected void setParameters(java.lang.Object[] params,
Message message)
public void onMessage(Message message)
MessageObserveronMessage in interface MessageObserverpublic Conduit getConduit()
ClientgetConduit in interface Clientprotected void prepareConduitSelector(Message message)
protected void setOutMessageProperties(Message message, BindingOperationInfo boi)
protected void setExchangeProperties(Exchange exchange, Endpoint endpoint, BindingOperationInfo boi)
protected PhaseInterceptorChain setupInterceptorChain(Endpoint endpoint)
protected void modifyChain(InterceptorChain chain, Message ctx, boolean in)
protected void setEndpoint(Endpoint e)
public int getSynchronousTimeout()
public void setSynchronousTimeout(int synchronousTimeout)
public final ConduitSelector getConduitSelector()
ClientgetConduitSelector in interface ClientgetConduitSelector in interface ConduitSelectorHolderprotected final ConduitSelector getConduitSelector(ConduitSelector override)
public final void setConduitSelector(ConduitSelector selector)
ClientsetConduitSelector in interface ClientsetConduitSelector in interface ConduitSelectorHolderselector - the ConduitSelector to usepublic void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exceptionpublic void setExecutor(java.util.concurrent.Executor executor)
ClientsetExecutor in interface Client