1 22 package org.jboss.ejb3.test.regression.ejbthree231; 23 24 import java.io.Serializable ; 25 import javax.ejb.Stateful ; 26 import javax.ejb.PostActivate ; 27 import javax.ejb.PrePassivate ; 28 import javax.ejb.SessionContext ; 29 import javax.annotation.Resource; 30 import org.jboss.annotation.ejb.cache.simple.CacheConfig; 31 32 38 @Stateful 39 @CacheConfig(maxSize = 1000, idleTimeoutSeconds = 1) 40 public class StatefulBean implements Serializable , StatefulRemote 41 { 42 public static boolean postActivateCalled = false; 43 public static boolean prePassivateCalled = false; 44 45 46 @Resource private SessionContext ctx; 47 private String state; 48 49 public boolean getPostActivate() 50 { 51 return postActivateCalled; 52 } 53 54 public boolean getPrePassivate() 55 { 56 return prePassivateCalled; 57 } 58 59 public void setState(String state) 60 { 61 this.state = state; 62 } 63 64 public String getState() 65 { 66 return this.state; 67 } 68 69 public void reset() 70 { 71 state = null; 72 postActivateCalled = false; 73 prePassivateCalled = false; 74 } 75 76 @PostActivate 77 public void postActivate() 78 { 79 postActivateCalled = true; 80 } 81 82 @PrePassivate 83 public void prePassivate() 84 { 85 prePassivateCalled = true; 86 } 87 } 88 | Popular Tags |