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 36 public class CounterSessionBean implements SessionBean 37 { 38 private static final Logger log = Logger.getLogger(CounterSessionBean.class); 39 40 private static int ejbCreateCounter = 0; 41 private static int ejbRemoveCounter = 0; 42 43 45 static synchronized int increaseCreateCounter() 46 { 47 return ejbCreateCounter++; 48 } 49 50 static synchronized int increaseRemoveCounter() 51 { 52 return ejbRemoveCounter++; 53 } 54 55 57 public CounterSessionBean() {} 58 59 61 public int getCreateCounter() 62 { 63 synchronized(CounterSessionBean.class) 64 { 65 return ejbCreateCounter; 66 } 67 } 68 69 public int getRemoveCounter() 70 { 71 synchronized(CounterSessionBean.class) 72 { 73 return ejbRemoveCounter; 74 } 75 } 76 77 public void clearCounters() 78 { 79 synchronized(CounterSessionBean.class) 80 { 81 ejbCreateCounter = 0; 82 ejbRemoveCounter = 0; 83 } 84 } 85 86 88 public void setSessionContext(SessionContext ctx) {} 89 public void ejbCreate() throws CreateException {} 90 public void ejbRemove() {} 91 public void ejbActivate() {} 92 public void ejbPassivate() {} 93 } 94 | Popular Tags |