public class ClientImpl extends AbstractBasicInterceptorProvider implements Client, Retryable, MessageObserver
Modifier and Type | Class and Description |
---|---|
static class |
ClientImpl.EchoContext |
Modifier and Type | Field and Description |
---|---|
protected Bus |
bus |
protected ConduitSelector |
conduitSelector |
protected Map<String,Object> |
currentRequestContext |
protected Executor |
executor |
static String |
FINISHED |
protected PhaseChainCache |
inboundChainCache |
protected PhaseChainCache |
outboundChainCache |
protected ClientOutFaultObserver |
outFaultObserver |
protected Map<Thread,ClientImpl.EchoContext> |
requestContext |
protected Map<Thread,Map<String,Object>> |
responseContext |
static 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 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 |
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) |
Endpoint |
getEndpoint() |
protected Exception |
getException(Exchange exchange) |
Map<String,Object> |
getRequestContext()
Gets the request context used for future invocations
|
Map<String,Object> |
getResponseContext()
Gets the response context from the last invocation on this thread
|
int |
getSynchronousTimeout() |
Object[] |
invoke(BindingOperationInfo oi,
Object... params)
Invokes an operation synchronously
|
Object[] |
invoke(BindingOperationInfo oi,
Object[] params,
Exchange exchange) |
Object[] |
invoke(BindingOperationInfo oi,
Object[] params,
Map<String,Object> context)
Invokes an operation synchronously
|
Object[] |
invoke(BindingOperationInfo oi,
Object[] params,
Map<String,Object> context,
Exchange exchange)
Invokes an operation synchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
Object... params)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
Object[] params,
Exchange exchange)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
Object[] params,
Map<String,Object> context)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
BindingOperationInfo oi,
Object[] params,
Map<String,Object> context,
Exchange exchange)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
QName operationName,
Object... params)
Invokes an operation asynchronously
|
void |
invoke(ClientCallback callback,
String operationName,
Object... params)
Invokes an operation asynchronously
|
Object[] |
invoke(QName operationName,
Object... params)
Invokes an operation synchronously
|
Object[] |
invoke(String operationName,
Object... params)
Invokes an operation synchronously
|
void |
invokeWrapped(ClientCallback callback,
QName operationName,
Object... params)
Invokes an operation asynchronously
|
void |
invokeWrapped(ClientCallback callback,
String operationName,
Object... params)
Invokes an operation asynchronously
|
Object[] |
invokeWrapped(QName operationName,
Object... params)
Invokes an operation synchronously
|
Object[] |
invokeWrapped(String operationName,
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 Object[] |
processResult(Message message,
Exchange exchange,
BindingOperationInfo oi,
Map<String,Object> resContext) |
void |
setConduitSelector(ConduitSelector selector)
Set the ConduitSelector responsible for retreiving the Conduit.
|
protected void |
setContext(Map<String,Object> ctx,
Message message) |
protected void |
setEndpoint(Endpoint e) |
protected void |
setExchangeProperties(Exchange exchange,
Endpoint endpoint,
BindingOperationInfo boi) |
void |
setExecutor(Executor executor)
Sets the executor which is used to process Asynchronous responses.
|
protected void |
setOutMessageProperties(Message message,
BindingOperationInfo boi) |
protected void |
setParameters(Object[] params,
Message message) |
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, setOutInterceptors
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors
public static final String THREAD_LOCAL_REQUEST_CONTEXT
public static final String SYNC_TIMEOUT
public static final String FINISHED
protected Bus bus
protected ConduitSelector conduitSelector
protected ClientOutFaultObserver outFaultObserver
protected int synchronousTimeout
protected PhaseChainCache outboundChainCache
protected PhaseChainCache inboundChainCache
protected Map<Thread,ClientImpl.EchoContext> requestContext
protected 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()
Client
public void destroy()
Client
public Endpoint getEndpoint()
getEndpoint
in interface Client
public Map<String,Object> getRequestContext()
Client
getRequestContext
in interface Client
public Map<String,Object> getResponseContext()
Client
getResponseContext
in interface Client
public boolean isThreadLocalRequestContext()
Client
isThreadLocalRequestContext
in interface Client
public void setThreadLocalRequestContext(boolean b)
Client
setThreadLocalRequestContext
in interface Client
public Object[] invoke(BindingOperationInfo oi, Object... params) throws Exception
Client
public Object[] invoke(String operationName, Object... params) throws Exception
Client
invoke
in interface Client
operationName
- 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 invokeWrappedException
public Object[] invoke(QName operationName, Object... params) throws Exception
Client
invoke
in interface Client
operationName
- 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 invokeWrappedException
public Object[] invokeWrapped(String operationName, Object... params) throws Exception
Client
invokeWrapped
in interface Client
operationName
- 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 operationException
public Object[] invokeWrapped(QName operationName, Object... params) throws Exception
Client
invokeWrapped
in interface Client
operationName
- The name of the operation to be invokedparams
- The params that matches the parts of the input message of the operationException
public Object[] invoke(BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception
Exception
public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context) throws Exception
Client
invoke
in interface Client
oi
- 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 invocationException
public void invoke(ClientCallback callback, String operationName, Object... params) throws Exception
Client
invoke
in interface Client
callback
- 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 invokeWrappedException
public void invoke(ClientCallback callback, QName operationName, Object... params) throws Exception
Client
invoke
in interface Client
callback
- 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 invokeWrappedException
public void invokeWrapped(ClientCallback callback, String operationName, Object... params) throws Exception
Client
invokeWrapped
in interface Client
callback
- 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 operationException
public void invokeWrapped(ClientCallback callback, QName operationName, Object... params) throws Exception
Client
invokeWrapped
in interface Client
callback
- 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 operationException
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object... params) throws Exception
Client
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context) throws Exception
Client
invoke
in interface Client
callback
- 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 invocationException
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Exchange exchange) throws Exception
Client
invoke
in interface Client
callback
- 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 invocationException
public void invoke(ClientCallback callback, BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception
Client
invoke
in interface Client
callback
- 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 invocationException
public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String,Object> context, Exchange exchange) throws Exception
Client
invoke
in interface Client
invoke
in interface Retryable
oi
- 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 invocationException
protected Object[] processResult(Message message, Exchange exchange, BindingOperationInfo oi, Map<String,Object> resContext) throws Exception
Exception
protected void waitResponse(Exchange exchange) throws IOException
IOException
public void onMessage(Message message)
MessageObserver
onMessage
in interface MessageObserver
public Conduit getConduit()
Client
getConduit
in interface Client
protected 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()
Client
getConduitSelector
in interface Client
getConduitSelector
in interface ConduitSelectorHolder
protected final ConduitSelector getConduitSelector(ConduitSelector override)
public final void setConduitSelector(ConduitSelector selector)
Client
setConduitSelector
in interface Client
setConduitSelector
in interface ConduitSelectorHolder
selector
- the ConduitSelector to usepublic void setExecutor(Executor executor)
Client
setExecutor
in interface Client
Copyright © 2016 JBoss by Red Hat. All rights reserved.