public final class EJBClientContext extends Attachable implements Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the EJB client context and notifies any registered
EJBClientContextListeners about
the context being closed. |
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.
|
protected void |
finalize() |
ClusterContext |
getClusterContext(String clusterName)
Deprecated.
|
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)
Deprecated.
|
static ContextSelector<EJBClientContext> |
getSelector()
Returns the current EJB client context selector
|
static boolean |
isSelectorLocked()
Returns true if the EJB client context cannot be changed because it has been
lockSelector(). |
static void |
lockSelector()
Prevent the selector from being changed again.
|
void |
registerConnection(org.jboss.remoting3.Connection connection)
Deprecated.
|
void |
registerConnection(org.jboss.remoting3.Connection connection,
String remotingProtocol)
Register a Remoting connection with this client context.
|
boolean |
registerEJBClientContextListener(EJBClientContextListener listener)
Registers a
EJBClientContextListener for this EJBClientContext. |
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)
Deprecated.
|
static EJBClientContext |
require(EJBClientContextIdentifier ejbClientContextIdentifier)
Returns a
EJBClientContext which is identified by the passed ejbClientContextIdentifier. |
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, getAttachments, putAttachment, putAttachmentIfAbsent, removeAttachment, removeAttachment, replaceAttachment, replaceAttachmentpublic 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
RuntimePermissionpublic static ContextSelector<EJBClientContext> setConstantContext(EJBClientContext context)
context - the context to setSecurityException - if a security manager is installed and you do not have the setEJBClientContextSelector RuntimePermissionpublic static ContextSelector<EJBClientContext> getSelector()
public static void lockSelector()
SecurityException.SecurityException - if a security manager is installed and you do not have the setEJBClientContextSelector
RuntimePermissionpublic static boolean isSelectorLocked()
lockSelector().
Returns false otherwise.public static EJBClientContext getCurrent()
public static EJBClientContext requireCurrent() throws IllegalStateException
IllegalStateException - if the current client context is not setpublic static EJBClientContext require(EJBClientContextIdentifier ejbClientContextIdentifier) throws IllegalStateException
EJBClientContext which is identified by the passed ejbClientContextIdentifier.
The EJBClientContext is identified with the help of the current selector. If the
current selector is not of type IdentityEJBClientContextSelector or if that selector
can't return a EJBClientContext
for the passed ejbClientContextIdentifier then this method throws an IllegalStateExceptionejbClientContextIdentifier - The EJB client context identifierIllegalStateException - If this method couldn't find a EJBClientContext for the passed ejbClientContextIdentifierpublic 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 null@Deprecated public void registerConnection(org.jboss.remoting3.Connection connection)
connection - the connection to registerpublic void registerConnection(org.jboss.remoting3.Connection connection,
String remotingProtocol)
connection - the connection to registerremotingProtocol - The remoting protocol. Can be 'remote', 'http-remoting' or 'https-remoting'public 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 IllegalArgumentExceptionpriority - 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 EJBClientConfigurationpublic void registerReconnectHandler(ReconnectHandler reconnectHandler)
ReconnectHandler in this EJBClientContextreconnectHandler - The reconnect handler. Cannot be nullpublic void unregisterReconnectHandler(ReconnectHandler reconnectHandler)
ReconnectHandler from this EJBClientContextreconnectHandler - The reconnect handler to unregisterpublic boolean registerEJBClientContextListener(EJBClientContextListener listener)
EJBClientContextListener for this EJBClientContext. The EJBClientContextListener
will be notified of lifecycle events related to the EJBClientContextlistener - The EJB client context listener. Cannot be null.listener was registered with this EJB client context. False otherwise.@Deprecated public 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 cluster@Deprecated public 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 cluster@Deprecated public void removeCluster(String clusterName)
clusterName from this client contextclusterName - The name of the clusterpublic void close()
throws IOException
EJBClientContextListeners about
the context being closed.close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2017 JBoss by Red Hat. All rights reserved.