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

ExplicitFailoverServerInterceptor

public class ExplicitFailoverServerInterceptor extends org.jboss.ejb.plugins.AbstractInterceptor
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.ExplicitFailoverClientInterceptor
author
Sacha Labourey.
version
$Revision: 57188 $

Revisions:

8 avril 2002 Sacha Labourey:

  • First implementation

Fields Summary
protected org.jboss.ejb.Container
container
Constructors Summary
public ExplicitFailoverServerInterceptor()

   
Methods Summary
protected voidcheckFailoverNeed(org.jboss.invocation.Invocation mi)

      Object data = mi.getValue ("DO_FAIL_DURING_NEXT_CALL");
      
      if (data != null &&
          data instanceof java.lang.Boolean &&
          data.equals (java.lang.Boolean.TRUE))
      {
         // we now determine if we have already failed
         //
         Object alreadyDone = mi.getValue ("FAILOVER_COUNTER");
         
         if (alreadyDone != null &&
             alreadyDone instanceof java.lang.Integer &&
             ((java.lang.Integer)alreadyDone).intValue () == 0)
         {
            // we do fail
            //
            this.log.debug ("WE FAILOVER IN SERVER INTERCEPTOR (explicit failover asked by client interceptor)!");
            throw new GenericClusteringException 
               (GenericClusteringException.COMPLETED_NO, "Test failover from server interceptor", false);
         }
      }
   
public org.jboss.ejb.ContainergetContainer()

      return container;
   
public java.lang.Objectinvoke(org.jboss.invocation.Invocation mi)

      checkFailoverNeed (mi);
      
      return super.invoke (mi);
   
public java.lang.ObjectinvokeHome(org.jboss.invocation.Invocation mi)

      checkFailoverNeed (mi);
      
     return super.invokeHome (mi);
   
public voidsetContainer(org.jboss.ejb.Container container)

      this.container = container;