1 7 8 package org.jboss.ejb3.test.stateful.nested; 9 10 import org.jboss.annotation.ejb.cache.tree.CacheConfig; 11 import org.jboss.logging.Logger; 12 13 import javax.ejb.*; 14 15 21 @Stateful(name="testNestedStateful") 22 @CacheConfig(maxSize=1000, idleTimeoutSeconds=3) public class NestedStatefulBean implements java.io.Serializable , NestedStateful 24 { 25 private Logger log = Logger.getLogger(NestedStatefulBean.class); 26 private int counter = 0; 27 28 public int increment() 29 { 30 log.debug("INCREMENT - counter: " + (counter++)); 31 return counter; 32 } 33 34 public static int postActivateCalled = 0; 35 public static int prePassivateCalled = 0; 36 37 public int getPostActivate() 38 { 39 return postActivateCalled; 40 } 41 42 public int getPrePassivate() 43 { 44 return prePassivateCalled; 45 } 46 47 public void reset() 48 { 49 counter = 0; 50 NestedStatefulBean.postActivateCalled = 0; 51 NestedStatefulBean.prePassivateCalled = 0; 52 } 53 54 @PostActivate 55 public void postActivate() 56 { 57 ++NestedStatefulBean.postActivateCalled; 58 log.debug("Activate with counter: " + counter); 59 } 60 61 @PrePassivate 62 public void prePassivate() 63 { 64 ++NestedStatefulBean.prePassivateCalled; 65 log.debug("Passivate with counter: " + counter); 66 } 67 68 } 69 | Popular Tags |