FileDocCategorySizeDatePackage
ExplicitFailoverInterceptor.javaAPI DocJBoss 4.2.11786Fri Jul 13 20:53:12 BST 2007org.jboss.ejb3.test.clusteredsession

ExplicitFailoverInterceptor

public class ExplicitFailoverInterceptor extends Object
Used for testing clustering: allows to explicitly makes a call to node fail This will mimic a dead server. This is used as a ejb3 interceptor now.
author
Ben Wang

Fields Summary
private Logger
log
Constructors Summary
Methods Summary
protected voidcheckFailoverNeed(javax.interceptor.InvocationContext ctx)

      if(ctx.getMethod().getName().equals("setUpFailover"))
      {
         return;
      }

      String failover = (String)System.getProperty ("JBossCluster-DoFail");
      boolean doFail = false;

      if (failover != null)
      {
         String strFailover = failover;
         if (strFailover.equalsIgnoreCase ("true"))
         {
            doFail = true;
         }
         else if (strFailover.equalsIgnoreCase ("once"))
         {
            doFail = true;
            System.setProperty ("JBossCluster-DoFail", "false");
         }
      }

      if (doFail)
      {
         GenericClusteringException e = new GenericClusteringException
         (GenericClusteringException.COMPLETED_NO, "Test failover from ejb interceptor", false);
         
         log.debug ("WE FAILOVER IN EJB INTERCEPTOR (explicit failover)!", e);

         throw e;
      }
   
public java.lang.Objectinvoke(javax.interceptor.InvocationContext ctx)


   
      
       
   
      checkFailoverNeed (ctx);
      return ctx.proceed();