FileDocCategorySizeDatePackage
SimpleStatefulBean.javaAPI DocJBoss 4.2.12965Fri Jul 13 20:52:58 BST 2007org.jboss.ejb3.test.cache

SimpleStatefulBean

public class SimpleStatefulBean extends Object implements SimpleStatefulRemote, SimpleStatefulLocal, Serializable
Comment
author
Bill Burke
version
$Revision: 57207 $

Fields Summary
public static boolean
postActivateCalled
public static boolean
prePassivateCalled
private String
state
Constructors Summary
Methods Summary
public longbench(int iterations)


        
   
      InitialContext ctx = new InitialContext();
      SimpleStatefulLocal local = (SimpleStatefulLocal) ctx.lookup("SimpleStatefulBean/local");
      long start = System.currentTimeMillis();
      for (int i = 0; i < iterations; i++)
      {
         local.getState();
      }
      long end = System.currentTimeMillis() - start;
      System.out.println(iterations + " simple iterations took: " + end);
      return end;
   
public booleangetPostActivate()

      return postActivateCalled;
   
public booleangetPrePassivate()

      return prePassivateCalled;
   
public java.lang.StringgetState()

      return this.state;
   
public voidlongRunning()

      Thread.sleep(11000);
   
public voidpostActivate()

      postActivateCalled = true;
   
public voidprePassivate()

      prePassivateCalled = true;
   
public voidreset()

      state = null;
      postActivateCalled = false;
      prePassivateCalled = false;
   
public voidsetState(java.lang.String state)

      this.state = state;