I have created a job to run every hour as follows
public class BackgroundJobManager implements ServletContextListener {
private ScheduledExecutorService scheduler;
public void contextInitialized(ServletContextEvent sce) {
.
.
scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.scheduleAtFixedRate(new HourlyJob(), 0, 1, TimeUnit.HOURS);
.
.
}
}
But HourlyJob()
is executing every 10 minutes instead of hourly. Not sure what wrong I am doing here.
Does anyone know why the TimeUnit.HOURS
is not considered as expected?
It may be an annotation for scheduled task's method @Schedule