I have a @Schedule method that i'm trying to debug, but is not being triggered:
@Singleton
public class FileScheduler {
@EJB
private DaoFactory daoFactory;
@Schedule(persistent = false, minute = "1")
public void FilesSubmited() throws EmailException {
System.out.println("Init");
}
What could be the reason that the schedule is not being activated?
You probably need @Startup . And if you want it to run every minute, the expression should be "*/1"
( more about expressions ):
@Startup
@Singleton
public class FileScheduler {
@EJB
private DaoFactory daoFactory;
@Schedule(persistent = false, minute = "*/1")
public void FilesSubmited() throws EmailException {
System.out.println("Init");
}
}
The EJB container initiates the singleton session bean upon application deployment if the singleton is annotated with the @Startup
annotation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.