-
1. Re: How to close remote ejb/jndi connections
ropalka Mar 19, 2012 3:58 AM (in response to michael_gronau)Hello, the following solution works for us:
InitialContext ctx = new InitialContext(remoteEjbProperties); try { ... // do something with ctx, e.g. lookup & use EJBs via ejb: remote protocol ... } finally { ctx.close(); }
But I see your requirement is different
It seems you want to have the control over the specific remoting connection, right?
-
2. Re: How to close remote ejb/jndi connections
jaikiran Mar 19, 2012 4:24 AM (in response to michael_gronau)How are you creating the EJB client context and registering the receivers?
-
3. Re: How to close remote ejb/jndi connections
michael_gronau Mar 19, 2012 4:30 AM (in response to jaikiran)Hi jaikiran,
I'm just doing it like this:
this.ejbClientProperties.setProperty("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false"); this.ejbClientProperties.setProperty("remote.connections", "default"); this.ejbClientProperties.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); // this.ejbClientProperties.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_MECHANISMS", "PLAIN"); this.ejbClientProperties.setProperty("remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER"); this.ejbClientProperties.setProperty("remote.connection.default.host" , this.host); this.ejbClientProperties.setProperty("remote.connection.default.port", Integer.toString(this.port)); this.ejbClientProperties.setProperty("callback.handler.class", AnonymousSaslClientCallbackHandler.class.getName()); Hashtable jndiProperties = new Hashtable(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); //
this.ejbNamingContext = new InitialContext(jndiProperties); then i simply look up the ejb's via this.ejbNamingContext.lookup(...)
I debugged a little bit around and when i close the ejbNamingContext there is no special code executed to close the underlying connections, because the context is an instance of javax.naming.InitialContext, which does nearly nothing in its close() method.
-
4. Re: How to close remote ejb/jndi connections
michael_gronau Mar 19, 2012 4:43 AM (in response to michael_gronau)Oh, and there is a little bit more:
after creating the ejb context with new InitialContext I create a new connection using the member variable this.ejbClientProperties like this:
new PropertiesBasedEJBClientConfiguration(this.ejbClientProperties);