FileDocCategorySizeDatePackage
ExplicitFailoverClientInterceptor.javaAPI DocJBoss 4.2.13505Fri Jul 13 20:52:36 BST 2007org.jboss.ha.framework.test

ExplicitFailoverClientInterceptor

public class ExplicitFailoverClientInterceptor extends org.jboss.proxy.Interceptor
Used for testing clustering: allows to explicitely makes a call to node fail This will mimic a dead server.
see
org.jboss.ha.framework.test.ExplicitFailoverServerInterceptor
author
Sacha Labourey.
version
$Revision: 57188 $

Revisions:

8 avril 2002 Sacha Labourey:

  • First implementation

Fields Summary
Constructors Summary
public ExplicitFailoverClientInterceptor()

   
Methods Summary
public java.lang.Objectinvoke(org.jboss.invocation.Invocation mi)

      Object failover = System.getProperty ("JBossCluster-DoFail");
      boolean doFail = false;
      
      if (failover != null && 
          failover instanceof java.lang.String)
      {
         String strFailover = (java.lang.String)failover;
         if (strFailover.equalsIgnoreCase ("true"))
         {
            doFail = true;
         }
         else if (strFailover.equalsIgnoreCase ("once"))
         {
            doFail = true;
            System.setProperty ("JBossCluster-DoFail", "false");
         }          
      }
      
      if (doFail)
      {
         mi.setValue ("DO_FAIL_DURING_NEXT_CALL", Boolean.TRUE, PayloadKey.AS_IS);
         System.out.println("SYSTEM : We fail during next call!!!");
      }
      else
         mi.setValue ("DO_FAIL_DURING_NEXT_CALL", Boolean.FALSE, PayloadKey.AS_IS);
         

      return getNext().invoke(mi);