public final class EJBClientContext extends Attachable
Modifier and Type | Method and Description |
---|---|
static EJBClientContext |
create()
Creates and returns a new client context.
|
static EJBClientContext |
create(ClassLoader classLoader)
Creates and returns a new client context, using the given class loader to look for initializers.
|
static EJBClientContext |
create(EJBClientConfiguration ejbClientConfiguration)
Creates and returns a new client context.
|
static EJBClientContext |
create(EJBClientConfiguration ejbClientConfiguration,
ClassLoader classLoader)
Creates and returns a new client context, using the given class loader to look for initializers.
|
ClusterContext |
getClusterContext(String clusterName)
Returns a
ClusterContext corresponding to the passed clusterName . |
static EJBClientContext |
getCurrent()
Get the current client context for this thread.
|
EJBClientConfiguration |
getEJBClientConfiguration()
Returns the
EJBClientConfiguration applicable to this EJB client context. |
ClusterContext |
getOrCreateClusterContext(String clusterName)
Returns a
ClusterContext corresponding to the passed clusterName . |
static void |
lockSelector()
Prevent the selector from being changed again.
|
void |
registerConnection(Connection connection)
Register a Remoting connection with this client context.
|
boolean |
registerEJBReceiver(EJBReceiver receiver)
Register an EJB receiver with this client context.
|
EJBClientInterceptor.Registration |
registerInterceptor(int priority,
EJBClientInterceptor clientInterceptor)
Register a client interceptor with this client context.
|
void |
registerReconnectHandler(ReconnectHandler reconnectHandler)
Registers a
ReconnectHandler in this EJBClientContext |
void |
removeCluster(String clusterName)
Removes the cluster identified by the
clusterName from this client context |
static EJBClientContext |
requireCurrent()
Get the current client context for this thread, throwing an exception if none is set.
|
static ContextSelector<EJBClientContext> |
setConstantContext(EJBClientContext context)
Set a constant EJB client context.
|
static ContextSelector<EJBClientContext> |
setSelector(ContextSelector<EJBClientContext> newSelector)
Sets the EJB client context selector.
|
void |
unregisterEJBReceiver(EJBReceiver receiver)
Unregister (a previously registered) EJB receiver from this client context.
|
void |
unregisterReconnectHandler(ReconnectHandler reconnectHandler)
Unregisters a
ReconnectHandler from this EJBClientContext |
getAttachment, putAttachment, putAttachmentIfAbsent, removeAttachment, removeAttachment, replaceAttachment, replaceAttachment
public static EJBClientContext create()
public static EJBClientContext create(ClassLoader classLoader)
classLoader
- the class loader. Cannot be nullpublic static EJBClientContext create(EJBClientConfiguration ejbClientConfiguration)
ejbClientConfiguration
will
be used by this client context during any of the context management activities (like auto-creation
of remoting EJB receivers)ejbClientConfiguration
- The EJB client configuration. Can be null.public static EJBClientContext create(EJBClientConfiguration ejbClientConfiguration, ClassLoader classLoader)
ejbClientConfiguration
will be used by this client context during any of
the context management activities (like auto-creation of remoting EJB receivers)ejbClientConfiguration
- The EJB client configuration. Can be null.classLoader
- The class loader. Cannot be nullpublic static ContextSelector<EJBClientContext> setSelector(ContextSelector<EJBClientContext> newSelector)
newSelector
- The selector to set. Cannot be nullSecurityException
- if a security manager is installed and you do not have the setEJBClientContextSelector
RuntimePermission
public static ContextSelector<EJBClientContext> setConstantContext(EJBClientContext context)
context
- the context to setSecurityException
- if a security manager is installed and you do not have the setEJBClientContextSelector
RuntimePermission
public static void lockSelector()
SecurityException
.SecurityException
- if a security manager is installed and you do not have the setEJBClientContextSelector
RuntimePermission
public static EJBClientContext getCurrent()
public static EJBClientContext requireCurrent() throws IllegalStateException
IllegalStateException
- if the current client context is not setpublic boolean registerEJBReceiver(EJBReceiver receiver)
EJBReceiver
has already been associated in this client context or if a receiver
with the same node name
has already been associated in this client
context, then this method does not register the passed receiver
and returns false.receiver
- the receiver to registerIllegalArgumentException
- If the passed receiver
is nullpublic void unregisterEJBReceiver(EJBReceiver receiver)
receiver
- The EJB receiver to unregisterIllegalArgumentException
- If the passed receiver
is nullpublic void registerConnection(Connection connection)
connection
- the connection to registerpublic EJBClientInterceptor.Registration registerInterceptor(int priority, EJBClientInterceptor clientInterceptor) throws IllegalArgumentException
clientInterceptor
is already added to this context with the same priority
then this method just returns the old EJBClientInterceptor.Registration
. If however,
the clientInterceptor
is already registered in this context with a different priority then this method
throws an IllegalArgumentException
priority
- the absolute priority of this interceptor (lower runs earlier; higher runs later)clientInterceptor
- the interceptor to registerIllegalArgumentException
- if the given interceptor is null
, the priority is less than 0, or the
given interceptor is already registered with a different prioritypublic EJBClientConfiguration getEJBClientConfiguration()
EJBClientConfiguration
applicable to this EJB client context. Returns null
if this EJB client context isn't configured with a EJBClientConfiguration
public void registerReconnectHandler(ReconnectHandler reconnectHandler)
ReconnectHandler
in this EJBClientContext
reconnectHandler
- The reconnect handler. Cannot be nullpublic void unregisterReconnectHandler(ReconnectHandler reconnectHandler)
ReconnectHandler
from this EJBClientContext
reconnectHandler
- The reconnect handler to unregisterpublic ClusterContext getOrCreateClusterContext(String clusterName)
ClusterContext
corresponding to the passed clusterName
. If no
such cluster context exists, a new one is created and returned. Subsequent invocations on this
EJBClientContext
for the same cluster name will return this same ClusterContext
, unless
the cluster has been removed from this client context.clusterName
- The name of the clusterpublic ClusterContext getClusterContext(String clusterName)
ClusterContext
corresponding to the passed clusterName
. If no
such cluster context exists, then this method returns null.clusterName
- The name of the clusterpublic void removeCluster(String clusterName)
clusterName
from this client contextclusterName
- The name of the clusterCopyright © 2012 JBoss by Red Hat. All Rights Reserved.