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

StatefulBean

public class StatefulBean extends Object implements StatefulRemote, StatefulLocal, 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();
      StatefulLocal local = (StatefulLocal) ctx.lookup("StatefulBean/local");
      long start = System.currentTimeMillis();
      for (int i = 0; i < iterations; i++)
      {
         local.getState();
      }
      long end = System.currentTimeMillis() - start;
      System.out.println(iterations + " stateful iterations took: " + end);
      return end;
   
public voiddone()

   
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;