EJB lookup is very slow when not all servers are running in JBoss EAP 6.1

Solution Verified - Updated -

Issue

  • Slow startup of standalone ejb clients if not all defined server connections are available
  • Have two JBoss EAP 6.1 instances running. Our client use the properties listed at the bottom for the InitialContext.

The problem:

server1 started normally. server2 not started yet (it depends on server1 and may take a while to start so not fully started).

It takes more than 5 seconds for a client to use the InitialContext to lookup an EJB in server1 (already started) because it needs to wait for timeout of server2 (default 5 seconds) in the following stacktrace for every lookup:

IoFutureHelper.get(IoFuture<V>, long, TimeUnit) line: 93    
ConfigBasedEJBClientContextSelector.setupEJBReceivers() line: 148   
ConfigBasedEJBClientContextSelector.<init>(EJBClientConfiguration, ClassLoader) line: 105   
ConfigBasedEJBClientContextSelector.<init>(EJBClientConfiguration) line: 73 
EjbNamingContext.createIdentifiableEjbClientContext(Hashtable) line: 227    
EjbNamingContext.<init>(Hashtable<?,?>) line: 107   
ejbURLContextFactory.getObjectInstance(Object, Name, Context, Hashtable<?,?>) line: 38  
NamingManager.getURLObject(String, Object, Name, Context, Hashtable) line: 601  
NamingManager.getURLContext(String, Hashtable<?,?>) line: 550   
InitialContext.getURLOrDefaultInitCtx(String) line: 339 
InitialContext.lookup(String) line: 411 
ScopeSampleClient.main(String[]) line: 46   

We know we can set the timeout value for server2 to a shorter time but not sure what other issue it may cause.

For example, when setting to 100ms, we have seen the timeout exception is thrown when the server is actually running. We just did not give it enough time.

So any suggestion in this issue?
In this example a scoped-context is used.

env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
env.put("org.jboss.ejb.client.scoped.context", true);

env.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
env.put("remote.connections","server1,server2");

env.put("remote.connection.server1.host","localhost");
env.put("remote.connection.server1.port","4447");
env.put("remote.connection.server1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS","false");
env.put("remote.connection.server1.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT","false");
env.put("remote.connection.server1.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS","JBOSS-LOCAL-USER");
env.put("remote.connection.server1.connect.options.org.jboss.remoting3.RemotingOptions.HEARTBEAT_INTERVAL","60000");
env.put("remote.connection.server1.username","user");
env.put("remote.connection.server1.password","password");

env.put("remote.connection.server2.host","localhost");
env.put("remote.connection.server2.port","4647");
// env.put("remote.connection.server2.connect.timeout", "500");
env.put("remote.connection.server2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS","false");
env.put("remote.connection.server2.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT","false");
env.put("remote.connection.server2.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS","JBOSS-LOCAL-USER");
env.put("remote.connection.server2.connect.options.org.jboss.remoting3.RemotingOptions.HEARTBEAT_INTERVAL","60000");
env.put("remote.connection.server2.username","user");
env.put("remote.connection.server2.password","password");

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 6.0.x
    • 6.1.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In