JBoss.org Community Documentation

15.2.4. Handling Cluster Restart

We have covered the HA smart client architecture in the section called “Client-side interceptor architecture”. The default HA smart proxy client can only failover as long as one node in the cluster exists. If there is a complete cluster shutdown, the proxy becomes orphaned and loses knowledge of the available nodes in the cluster. There is no way for the proxy to recover from this. The proxy needs to look up a fresh set of targets out of JNDI/HAJNDI when the nodes are restarted.

The 3.2.7+/4.0.2+ releases contain a RetryInterceptor that can be added to the proxy client side interceptor stack to allow for a transparent recovery from such a restart failure. To enable it for an EJB, setup an invoker-proxy-binding that includes the RetryInterceptor. Below is an example jboss.xml configuration.

 
 <jboss>
 <session>
 	<ejb-name>nextgen_RetryInterceptorStatelessSession</ejb-name>
 	<invoker-bindings>
 	<invoker>
 	<invoker-proxy-binding-name>
 	clustered-retry-stateless-rmi-invoker
 	</invoker-proxy-binding-name>
 	<jndi-name>
 	nextgen_RetryInterceptorStatelessSession
 	</jndi-name>
 	</invoker>
 	</invoker-bindings>
 	<clustered>true</clustered>
 </session>
  
 <invoker-proxy-binding>
 	<name>clustered-retry-stateless-rmi-invoker</name>
	 <invoker-mbean>jboss:service=invoker,type=jrmpha</invoker-mbean>
 	<proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
	 <proxy-factory-config>
 	<client-interceptors>
 		<home>
 		<interceptor>
 		org.jboss.proxy.ejb.HomeInterceptor
 		</interceptor>
		<interceptor>
		org.jboss.proxy.SecurityInterceptor
		</interceptor>
		<interceptor>
  		org.jboss.proxy.TransactionInterceptor
  		</interceptor>
 		<interceptor>
 		org.jboss.proxy.ejb.RetryInterceptor
 		</interceptor>
  		<interceptor>
  		org.jboss.invocation.InvokerInterceptor
  		</interceptor>
  	</home>
 	<bean>
 		 <interceptor>
  		org.jboss.proxy.ejb.StatelessSessionInterceptor
 		 </interceptor>
		 <interceptor>
		 org.jboss.proxy.SecurityInterceptor
 		</interceptor>
		 <interceptor>
		org.jboss.proxy.TransactionInterceptor
		</interceptor>
		<interceptor>
		org.jboss.proxy.ejb.RetryInterceptor
 		</interceptor>
 		<interceptor>
 		org.jboss.invocation.InvokerInterceptor
		</interceptor>
	</bean>
	  </client-interceptors>
	  </proxy-factory-config>
 </invoker-proxy-binding>