-
1. Re: Custer node not anymore an EJBReceiver after restart
jcavezian Feb 10, 2014 5:34 AM (in response to jcavezian)Please let me answer to myself...
If not a bug, this is the way it is implemented.
Good to add I was talking about SLSB EJBReceivers..
Here is my explanation (actually what I understood)
At boot time, during application deployment, EJBClientContext singleton is instanciated. The EJBClientContext.ejbReceiverAssociations are registered based based on remoting-ejb-receiver defined in META-INF/jboss-ejb-client.xml file.
When a node goes down, those remoting-ejb-receivers are unregistered :
EJBClientContext.unregisterEJBReceiver(final EJBReceiver receiver)
is called.
At this point, there seems to be no way JBoss registers again those EJBReceivers when the node comes up again.
And here is a workaround, please tell me if there is another one, a little less tricky.
To force reloading, the only solution I found is trying to lookup a none existing statefull EJB.
try { //donwlevel API call to create a session on a statefull EJB EJBClient.createSession(Object.class, "", "", "", ""); } catch (Exception e) { //obviously there is an exception
}
As the EJB we are looking up could not be found among known EJBReceivers, this stackcall invokes
private Collection<EJBReceiver> getEJBReceivers(final String appName, final String moduleName, final String distinctName, final boolean attemptReconnect) { final Collection<EJBReceiver> eligibleEJBReceivers = new HashSet<EJBReceiver>(); synchronized (this.ejbReceiverAssociations) { for (final Map.Entry<EJBReceiver, ReceiverAssociation> entry : this.ejbReceiverAssociations.entrySet()) { if (entry.getValue().associated) { final EJBReceiver ejbReceiver = entry.getKey(); if (ejbReceiver.acceptsModule(appName, moduleName, distinctName)) { eligibleEJBReceivers.add(ejbReceiver); } } } } if (eligibleEJBReceivers.isEmpty() && attemptReconnect) { // we found no receivers, so see if we there are re-connect handlers which can create possible // receivers this.attemptReconnections(); // now that the re-connect handlers have run, let's fetch the receivers (if any) for this app/module/distinct-name // combination. We won't attempt any reconnections now. eligibleEJBReceivers.addAll(this.getEJBReceivers(appName, moduleName, distinctName, false)); } return eligibleEJBReceivers; }
And as eligbleEJBReceivers is obviously empty as this EJB could not be found among registered EJBReceivers, reconnection attempt are triggered.
Et voila !
All RemotingEJBReceivers are registered again, and load-balancing is swingging as expected ;-)
-
2. Re: Custer node not anymore an EJBReceiver after restart
manmeetjboss May 15, 2014 8:11 AM (in response to jcavezian)Don't you think it has performance hit? We should look for alternative solution.
-
3. Re: Custer node not anymore an EJBReceiver after restart
jaikiran May 15, 2014 9:28 AM (in response to manmeetjboss)You can add a custom ClusterNodeSelector and in its implementation select any node that belongs to the cluster, even if that node is not connected. The EJB client library will do the connection once you select it in the ClusterNodeSelector implementation: