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