1 22 package org.jboss.ejb3.test.regression.ejbthree670; 23 24 import java.rmi.RemoteException ; 25 26 import javax.annotation.PreDestroy; 27 import javax.ejb.EJBException ; 28 import javax.ejb.Remote ; 29 import javax.ejb.RemoteHome ; 30 import javax.ejb.Remove ; 31 import javax.ejb.SessionBean ; 32 import javax.ejb.SessionContext ; 33 import javax.ejb.Stateful ; 34 35 import org.jboss.logging.Logger; 36 37 43 @Stateful 44 @Remote (MyStateful21.class) 45 @RemoteHome (MyStateful21Home.class) 46 public class MyStateful21Bean implements SessionBean 47 { 48 private static final Logger log = Logger.getLogger(MyStateful21Bean.class); 49 50 private String name; 51 private int preDestroyCalls = 0; 52 53 public void ejbActivate() throws EJBException , RemoteException 54 { 55 } 56 57 public void ejbPassivate() throws EJBException , RemoteException 58 { 59 } 60 61 public void ejbRemove() throws EJBException , RemoteException 62 { 63 log.info("remove"); 64 } 65 66 public void setSessionContext(SessionContext ctx) throws EJBException , RemoteException 67 { 68 } 69 70 @PreDestroy 71 public void preDestroy() 72 { 73 preDestroyCalls++; 75 log.info("pre destroy"); 76 if(preDestroyCalls > 1) 77 throw new IllegalStateException ("pre destroy called multiple times"); 78 } 79 80 public String sayHello() 81 { 82 return "Hi " + name; 83 } 84 85 public void setName(String name) 86 { 87 this.name = name; 88 } 89 90 } 91 | Popular Tags |