I'm trying to set a timer for a Stateless EJB in Glassfish 2.1:
@Stateless(mappedName = "ServiceEJB")
public class ServiceEJB implements ServiceEJBRemote {
// other methods ...
// defining the timer
@Schedule(second="*/15", minute="*", hour="*")
public void test(){
System.out.println("++++++++ timer!!! ++++++++++++++++++++");
}
}
From what I've read, all I need to do is deploy the application and this should work. I was expecting to see in the log the printed text from the method test (every 15 seconds). A开发者_C百科re there any other steps I need to take in order for this to work?
Thank you!
Following my comment to the question:
The @Schedule
annotation is a feature of EJB 3.1. Glassfish 2.1 uses EJB 3 whereas Glassfish 3 uses EJB 3.1 and therefore should be suited better.
精彩评论