Sto utilizzando l'attuale quarzo 1.8.3 su jboss 4.0.5. I lavori al quarzo sono persistenti e salvati in un database locale. Quando chiamo il metodo shutdown o standby sull'oggetto scheduler in esecuzione quartz i lavori continuano a essere eseguiti dallo scheduler, solo che lo stato dei lavori è vuoto e l'esecuzione non riesce.Quartz Scheduler non si ferma dopo lo spegnimento
Mi aspetterei (almeno secondo la documentazione dell'API di quarzo) che quando si spegne o si mette in standby lo schedulatore, i lavori precedentemente programmati nel database non verranno eseguiti.
Se chiamare lo spegnimento o lo standby sullo scheduler non è il metodo per ottenere ciò, che cos'è?
I lavori non stanno terminando l'esecuzione ma i lavori pianificati continuano a essere attivati.
Ecco informazioni aggiuntive come ha chiesto:
public class QuartzNotificationsSchedulerBean implements NotificationsScheduler, ServletContextAware {
...
public String scheduleNotification(Notification notification) {
// Schedule the job with the trigger
try {
// Define job instance
String groupName = this.createNotificationGroupName(notification);
String triggerName = this.createNoficationTriggerName(notification);
String jobName = this.createNoficationJobName(notification);
JobDetail job = new JobDetail(jobName, groupName , ScheduledNotificationJob.class);
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.putAll(notification.getContext());
job.setJobDataMap(jobDataMap);
Calendar notificationTime = notification.getTime();
Trigger trigger = new SimpleTrigger(triggerName, groupName , notificationTime.getTime());
scheduler.scheduleJob(job, trigger);
return trigger.getName();
} catch (SchedulerException e) {
throw new NotificationScheduleException(e, notification);
}
return null;
}
public void setServletContext(ServletContext servletContext) {
this.sf = (SchedulerFactory) servletContext.getAttribute(QuartzInitializerListener.QUARTZ_FACTORY_KEY);
try {
scheduler = sf.getScheduler();
if(scheduler.isStarted() == false) {
scheduler.start();
}
} catch (SchedulerException e) {
logger.error("Failed to load Quartz scheduler ", e);
}
}
}
Quello che segue è una copia delle proprietà di configurazione di quarzo:
#============================================================================
# Configure Main Scheduler Properties
#============================================================================
org.quartz.scheduler.instanceName = scheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.scheduler.wrapJobExecutionInUserTransaction = true
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 45
org.quartz.threadPool.threadPriority = 5
#============================================================================
# Configure JobStore
#============================================================================
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = FOR_QUARTZ
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000
#============================================================================
# Configure Datasources
#============================================================================
org.quartz.dataSource.FOR_QUARTZ.jndiURL = java:jdbc/live-quartz
Ecco un frammento dal web.xml dove il quarzo è inizializzati:
<!-- START NOTIFICATION SERVICE -->
<context-param>
<param-name>config-file</param-name>
<param-value>wm_quartz.properties</param-value>
</context-param>
<context-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>start-scheduler-on-load</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.quartz.ee.servlet.QuartzInitializerListener</listener-class>
</listener>
Grazie
Ok grazie, ho fatto –
Che tipo di scheduler di quarzo stai usando? Potresti postare l'inizializzazione potrebbe del servizio e dello schedulatore? – Falle1234
sono solo i lavori in esecuzione che terminano la loro esecuzione o sono in esecuzione anche i lavori pianificati? –