org.quartz.impl.StdScheduler Java Examples

The following examples show how to use org.quartz.impl.StdScheduler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CleanHistorySettingsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
protected void afterChange(Form<?> form, AjaxRequestTarget target) {
	Settings settings = (Settings) form.getModelObject();
	if (!oldCronExpression.equals(settings.getCleanHistory().getCronExpression())) {
		// reschedule clean history
		StdScheduler scheduler = (StdScheduler) NextServerApplication.get().getSpringBean("scheduler");
		CronTriggerImpl cronTrigger = (CronTriggerImpl) NextServerApplication.get()
				.getSpringBean("cleanHistoryTrigger");
		try {
			cronTrigger.setCronExpression(settings.getCleanHistory().getCronExpression());
			scheduler.rescheduleJob(cronTrigger.getKey(), cronTrigger);
		} catch (Exception e) {
			e.printStackTrace();
			LOG.error(e.getMessage(), e);
		}
	}
}
 
Example #2
Source File: SynchronizerSettingsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
protected void afterChange(Form<?> form, AjaxRequestTarget target) {	
    	Settings settings = (Settings)form.getModelObject();	    	    
    	if (!oldCronExpression.equals(settings.getSynchronizer().getCronExpression())) {	    		
    		// reschedule user synchronizer
    		StdScheduler scheduler = (StdScheduler) NextServerApplication.get().getSpringBean("scheduler");
    		CronTriggerImpl cronTrigger = (CronTriggerImpl) NextServerApplication.get().getSpringBean("userSynchronizerTrigger");
    		try {
				cronTrigger.setCronExpression(settings.getSynchronizer().getCronExpression());										
				scheduler.rescheduleJob(cronTrigger.getKey(), cronTrigger);					
			} catch (Exception e) {					
				e.printStackTrace();
				LOG.error(e.getMessage(), e);
			}	    		
    	}
}