Package org.jboss.ejb.client
Class EJBClientInvocationContext
java.lang.Object
org.jboss.ejb.client.Attachable
org.jboss.ejb.client.AbstractInvocationContext
org.jboss.ejb.client.EJBClientInvocationContext
An invocation context for Enterprise Beans invocations from an Enterprise Bean client
- Author:
- David M. Lloyd, Jaikiran Pai
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicates to the server that a client side interceptor is interested in the context data that is stored under the given key.voidaddSuppressed(Throwable cause) Add a suppressed exception to the request.voidaddSuppressed(Supplier<? extends Throwable> cause) Add a suppressed exception to the request.booleanWait to determine whether this invocation was cancelled.voidDiscard the result from this request.intGet the compression hint level.Get the invoked proxy method.Get the invoked proxy object.Get the Enterprise Beans method locator.Get the method type signature string, used to identify the method.Object[]Get the invocation method parameters.<T> TgetProxyAttachment(AttachmentKey<T> key) Get a value attached to the proxy.longgetRemainingInvocationTime(TimeUnit timeUnit) Get the remaining invocation time in the given unit.Get the invocation result from this request.Determine whether the method has an explicit transaction policy set.booleanDetermine whether this invocation is currently blocking the calling thread.booleanDetermine whether the method is marked client-asynchronous, meaning that invocation should be asynchronous regardless of whether the server-side method is asynchronous.booleanDetermine whether the request is expected to be compressed.booleanDetermine whether the response is expected to be compressed.booleanDetermine whether the method is marked idempotent, meaning that the method may be invoked more than one time with no additional effect.booleanDetermine whether the method is definitely synchronous, that is, it is not marked client-async, and the return value of the method is notvoidorFuture<?>.<T> TremoveProxyAttachment(AttachmentKey<T> key) Remove a value attached to the proxy.voidRequest that the current operation be retried if possible.voidProceed with sending the request normally.voidsetBlockingCaller(boolean blockingCaller) Establish whether this invocation is currently blocking the calling thread.<T> voidsetLocator(EJBLocator<T> locator) Set the locator for the invocation target.Methods inherited from class org.jboss.ejb.client.AbstractInvocationContext
getAuthenticationContext, getClientContext, getContextData, getDestination, getInitialCluster, getLocator, getTargetAffinity, getTransaction, getViewClass, getWeakAffinity, setDestination, setTargetAffinity, setTransaction, setWeakAffinityMethods inherited from class org.jboss.ejb.client.Attachable
getAttachment, getAttachments, putAttachment, putAttachmentIfAbsent, removeAttachment, removeAttachment, replaceAttachment, replaceAttachment
-
Field Details
-
PRIVATE_ATTACHMENTS_KEY
- See Also:
-
RETURNED_CONTEXT_DATA_KEY
A context data key that may contain a Set of Strings. Any context data on the server side invocation context stored under these keys will be returned to the client.- See Also:
-
-
Method Details
-
addReturnedContextDataKey
Indicates to the server that a client side interceptor is interested in the context data that is stored under the given key. Any object on the context data map (i.e.InvocationContext.getContextData()that is present at the end of the server invocation will be serialised and returned to the client. If an object is present under this key and is not serializable then the request will fail.- Parameters:
key- The context data key the client interceptor is interested in
-
getProxyAttachment
Get a value attached to the proxy.- Type Parameters:
T- the value type- Parameters:
key- the attachment key- Returns:
- the value, or
nullif there is none
-
removeProxyAttachment
Remove a value attached to the proxy.- Type Parameters:
T- the value type- Parameters:
key- the attachment key- Returns:
- the value, or
nullif there is none
-
isClientAsync
public boolean isClientAsync()Determine whether the method is marked client-asynchronous, meaning that invocation should be asynchronous regardless of whether the server-side method is asynchronous.- Returns:
trueif the method is marked client-asynchronous,falseotherwise
-
isSynchronous
public boolean isSynchronous()Determine whether the method is definitely synchronous, that is, it is not marked client-async, and the return value of the method is notvoidorFuture<?>.- Returns:
trueif the method is definitely synchronous,falseif the method may be asynchronous
-
isIdempotent
public boolean isIdempotent()Determine whether the method is marked idempotent, meaning that the method may be invoked more than one time with no additional effect.- Returns:
trueif the method is marked idempotent,falseotherwise
-
getTransactionPolicy
Determine whether the method has an explicit transaction policy set.- Returns:
- the transaction policy, if any, or
nullif none was explicitly set
-
isCompressRequest
public boolean isCompressRequest()Determine whether the request is expected to be compressed.- Returns:
trueif the request is expected to be compressed,falseotherwise
-
isCompressResponse
public boolean isCompressResponse()Determine whether the response is expected to be compressed.- Returns:
trueif the response is expected to be compressed,falseotherwise
-
getCompressionLevel
public int getCompressionLevel()Get the compression hint level. If no compression hint is given, -1 is returned.- Returns:
- the compression hint level, or -1 for no compression hint
-
getMethodSignatureString
Get the method type signature string, used to identify the method.- Returns:
- the method signature string
-
getMethodLocator
Get the Enterprise Beans method locator.- Returns:
- the Enterprise Beans method locator
-
isBlockingCaller
public boolean isBlockingCaller()Determine whether this invocation is currently blocking the calling thread.- Returns:
trueif the calling thread is being blocked;falseotherwise
-
setBlockingCaller
public void setBlockingCaller(boolean blockingCaller) Establish whether this invocation is currently blocking the calling thread.- Parameters:
blockingCaller-trueif the calling thread is being blocked;falseotherwise
-
addSuppressed
Add a suppressed exception to the request.- Parameters:
cause- the suppressed exception (must not benull)
-
addSuppressed
Add a suppressed exception to the request.- Parameters:
cause- the suppressed exception (must not benull)
-
requestRetry
public void requestRetry()Description copied from class:AbstractInvocationContextRequest that the current operation be retried if possible.- Specified by:
requestRetryin classAbstractInvocationContext
-
sendRequest
Proceed with sending the request normally.- Throws:
Exception- if the request was not successfully sent
-
getResult
Get the invocation result from this request. The result is not actually acquired unless all interceptors call this method. Should only be called fromEJBClientInterceptor.handleInvocationResult(EJBClientInvocationContext).- Returns:
- the invocation result
- Throws:
Exception- if the invocation did not succeed
-
discardResult
Discard the result from this request. Should only be called fromEJBClientInterceptor.handleInvocationResult(EJBClientInvocationContext).- Throws:
IllegalStateException- if there is no result to discard
-
getInvokedProxy
Get the invoked proxy object.- Returns:
- the invoked proxy
-
getInvokedMethod
Get the invoked proxy method.- Returns:
- the invoked method
-
getParameters
Get the invocation method parameters.- Returns:
- the invocation method parameters
-
getRemainingInvocationTime
Get the remaining invocation time in the given unit. If there is no invocation timeout,Long.MAX_VALUEis always returned. If the invocation time has elapsed, 0 is returned.- Parameters:
timeUnit- the time unit (must not benull)- Returns:
- the invocation's remaining time in the provided unit
-
setLocator
Description copied from class:AbstractInvocationContextSet the locator for the invocation target.- Overrides:
setLocatorin classAbstractInvocationContext- Parameters:
locator- the locator for the invocation target
-
awaitCancellationResult
public boolean awaitCancellationResult()Wait to determine whether this invocation was cancelled.- Returns:
trueif the invocation was cancelled;falseif it completed or failed or the thread was interrupted
-