Java Reference
In-Depth Information
try{
System.out.println("EjbLiteSessionBean - start
: "+new Date());
Thread.sleep(1000*10);
System.out.println("EjbLiteSessionBean - end :
"+new Date());
}catch(Exception ex){
ex.printStackTrace();
}
}
@Schedule(persistent = false, minute = "*",
hour = "1")
public void nonPersistentEJBTimerService(){
System.out.println("nonPersistentEJBTimerService
method executed");
}
}
Changes made to the TimerService API
The EJB 3.2 Specification enhanced the TimerService API with a new method
called getAllTimers() . This method gives you the ability to access all active
timers in an EJB module. The following code demonstrates how to create different
types of timers, access their information, and cancel them; it makes use of the
getAllTimers() method:
@Stateless
public class ChangesInTimerAPI implements
ChangesInTimerAPILocal {
@Resource
TimerService timerService;
public void createTimer(){
Search WWH ::




Custom Search