1 22 package org.jboss.ejb3.test.regression.ejbthree670; 23 24 import javax.annotation.PreDestroy; 25 import javax.ejb.Remote ; 26 import javax.ejb.Remove ; 27 import javax.ejb.Stateful ; 28 29 import org.jboss.annotation.ejb.cache.Cache; 30 import org.jboss.ejb3.cache.simple.SimpleStatefulCache; 31 import org.jboss.logging.Logger; 32 33 39 @Stateful 40 @Remote (MyStateful.class) 41 public class MyStatefulBean implements MyStateful 42 { 43 private static final Logger log = Logger.getLogger(MyStatefulBean.class); 44 45 private String name; 46 private int preDestroyCalls = 0; 47 48 @PreDestroy 49 public void preDestroy() 50 { 51 preDestroyCalls++; 52 log.info("pre destroy"); 53 if(preDestroyCalls > 1) 54 throw new IllegalStateException ("pre destroy called multiple times"); 55 } 56 57 @Remove 58 public void remove() 59 { 60 log.info("remove"); 61 } 62 63 public String sayHello() 64 { 65 return "Hi " + name; 66 } 67 68 public void setName(String name) 69 { 70 this.name = name; 71 } 72 73 } 74 | Popular Tags |