User: slaboure Date: 02/04/08 09:16:23 Modified: src/main/org/jboss/invocation/jrmp/interfaces JRMPInvokerProxyHA.java Log: Pass a value with the invocation that allows any server side interceptor to know when a call result from a failover (and the number of tries) Revision Changes Path 1.5 +24 -1 jbossmx/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java Index: JRMPInvokerProxyHA.java =================================================================== RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JRMPInvokerProxyHA.java 11 Mar 2002 06:26:00 -0000 1.4 +++ JRMPInvokerProxyHA.java 8 Apr 2002 16:16:22 -0000 1.5 @@ -36,12 +36,17 @@ * JRMPInvokerProxy, local to the proxy and is capable of delegating to local and JRMP implementations * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * * <p><b>2001/11/19: marcf</b> * <ol> * <li>Initial checkin * </ol> +* <p><b>2002/04/08: Sacha Labourey</b> +* <ol> +* <li>Pass a value with the invocation that allows any server side interceptor to know + * when a call result from a failover (and the number of tries)</li> +* </ol> */ public class JRMPInvokerProxyHA extends JRMPInvokerProxy implements Externalizable { @@ -132,6 +137,12 @@ public Object invoke(Invocation invocation) throws Exception { + // we give the opportunity, to any server interceptor, to know if this a + // first invocation to a node or if it is a failovered call + // + int failoverCounter = 0; + invocation.setValue ("FAILOVER_COUNTER", new Integer(failoverCounter), invocation.AS_IS); + // optimize if calling another bean in same EJB-application if (isLocal(invocation)) { return InvokerInterceptor.getLocal().invoke(invocation); @@ -173,9 +184,21 @@ catch (java.rmi.UnknownHostException uhe) { } + catch (org.jboss.ha.framework.interfaces.GenericClusteringException gce) + { + // this is a generic clustering exception that contain the + // completion status: usefull to determine if we are authorized + // to re-issue a query to another node + // + if (gce.getCompletionStatus () != gce.COMPLETED_NO) + throw new java.rmi.RemoteException (gce.getMessage ()); + } // If we reach here, this means that we must fail-over remoteTargetHasFailed(target); target = (Invoker)getRemoteTarget(); + + failoverCounter++; + mi.setValue ("FAILOVER_COUNTER", new Integer(failoverCounter), invocation.AS_IS); } // if we get here this means list was exhausted throw new java.rmi.RemoteException("Service unavailable.");
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development