1 22 package org.jboss.test.session.ejb; 23 24 import javax.ejb.CreateException ; 25 import javax.ejb.SessionBean ; 26 import javax.ejb.SessionContext ; 27 28 import org.jboss.logging.Logger; 29 30 34 public class CountedSessionBean implements SessionBean 35 { 36 private static final Logger log = Logger.getLogger(CountedSessionBean.class); 37 38 public CountedSessionBean() 39 { 40 log.info("CTOR"); 41 } 42 43 45 public void doSomething(long delay) 46 { 47 log.info("doSomething(" + delay + ")"); 48 if (delay > 0) 49 { 50 try 51 { 52 Thread.sleep(delay); 53 } 54 catch (InterruptedException e) 55 { 56 Thread.currentThread().interrupt(); 57 } 58 } 59 } 60 61 63 public void setSessionContext(SessionContext ctx) 64 { 65 log.info("setSessionContext"); 66 } 67 68 public void ejbCreate() throws CreateException 69 { 70 log.info("ejbCreate - " + CounterSessionBean.increaseCreateCounter()); 71 } 72 73 public void ejbRemove() 74 { 75 log.info("ejbRemove - " + CounterSessionBean.increaseRemoveCounter()); 76 } 77 78 public void ejbActivate() 79 { 80 log.info("ejbActivate"); 81 } 82 83 public void ejbPassivate() 84 { 85 log.info("ejbPassivate"); 86 } 87 } 88 | Popular Tags |