1 27 28 package timer; 29 30 import javax.ejb.*; 31 32 37 public class TimerSessionBean implements SessionBean, TimerSessionRemoteBusiness, TimedObject { 38 private SessionContext context; 39 40 46 public void setSessionContext(SessionContext aContext) { 47 context = aContext; 48 } 49 50 53 public void ejbActivate() { 54 55 } 56 57 60 public void ejbPassivate() { 61 62 } 63 64 67 public void ejbRemove() { 68 69 } 70 72 76 public void ejbCreate() { 77 } 82 83 public void ejbTimeout(Timer timer) { 84 System.out.println("TimerSessionBean: ejbTimeout "); 85 } 86 87 90 public void myCreateTimer(long intervalDuration) { 91 System.out.println("TimerSessionBean: start createTimer "); 92 93 TimerService timerService = context.getTimerService(); 94 Timer timer = 95 timerService.createTimer(intervalDuration, "created timer"); 96 } 97 98 } 99 | Popular Tags |