/** * Expose the specified context attributes and/or the current * ApplicationContext in the Quartz SchedulerContext. */ private void populateSchedulerContext(Scheduler scheduler) throws SchedulerException { // Put specified objects into Scheduler context. if (this.schedulerContextMap != null) { scheduler.getContext().putAll(this.schedulerContextMap); } // Register ApplicationContext in Scheduler context. if (this.applicationContextSchedulerContextKey != null) { if (this.applicationContext == null) { throw new IllegalStateException( "SchedulerFactoryBean needs to be set up in an ApplicationContext " + "to be able to handle an 'applicationContextSchedulerContextKey'"); } scheduler.getContext().put(this.applicationContextSchedulerContextKey, this.applicationContext); } }
private void initialize() throws SchedulerException { scheduler.getContext().put(DeadlineJob.TRANSACTION_MANAGER_KEY, transactionManager); scheduler.getContext().put(DeadlineJob.SCOPE_AWARE_RESOLVER, scopeAwareProvider); scheduler.getContext().put(DeadlineJob.JOB_DATA_SERIALIZER, serializer); scheduler.getContext().put(DeadlineJob.HANDLER_INTERCEPTORS, handlerInterceptors()); }
/** * Expose the specified context attributes and/or the current * ApplicationContext in the Quartz SchedulerContext. */ private void populateSchedulerContext(Scheduler scheduler) throws SchedulerException { // Put specified objects into Scheduler context. if (this.schedulerContextMap != null) { scheduler.getContext().putAll(this.schedulerContextMap); } // Register ApplicationContext in Scheduler context. if (this.applicationContextSchedulerContextKey != null) { if (this.applicationContext == null) { throw new IllegalStateException( "SchedulerFactoryBean needs to be set up in an ApplicationContext " + "to be able to handle an 'applicationContextSchedulerContextKey'"); } scheduler.getContext().put(this.applicationContextSchedulerContextKey, this.applicationContext); } }
@Override public void initialize(String name, Scheduler scheduler, ClassLoadHelper helper) throws SchedulerException { getLog().info("Registering Job Interrupt Monitor Plugin"); this.name = name; this.executor = Executors.newScheduledThreadPool(1); scheduler.getContext().put(JOB_INTERRUPT_MONITOR_KEY, this); this.scheduler = scheduler; // Set the trigger Listener as this class to the ListenerManager here this.scheduler.getListenerManager().addTriggerListener(this); }
@Override public void initialize(String name, Scheduler scheduler, ClassLoadHelper helper) throws SchedulerException { getLog().info("Registering Job Interrupt Monitor Plugin"); this.name = name; this.executor = Executors.newScheduledThreadPool(1); scheduler.getContext().put(JOB_INTERRUPT_MONITOR_KEY, this); this.scheduler = scheduler; // Set the trigger Listener as this class to the ListenerManager here this.scheduler.getListenerManager().addTriggerListener(this); }
log.info("Storing the ServletContext in the scheduler context at key: " + servletCtxtKey); scheduler.getContext().put(servletCtxtKey, servletContext);
log.info("Storing the ServletContext in the scheduler context at key: " + servletCtxtKey); scheduler.getContext().put(servletCtxtKey, servletContext);
log("Storing the ServletContext in the scheduler context at key: " + servletCtxtKey); scheduler.getContext().put(servletCtxtKey, cfg.getServletContext());
log("Storing the ServletContext in the scheduler context at key: " + servletCtxtKey); scheduler.getContext().put(servletCtxtKey, cfg.getServletContext());
getScheduler().getContext().put(JOB_INITIALIZATION_PLUGIN_NAME + '_' + getName(), this);
getScheduler().getContext().put(JOB_INITIALIZATION_PLUGIN_NAME + '_' + getName(), this);
scheduler.getContext().put((String)key, val);
scheduler.getContext().put((String)key, val);
public JobScheduler(BimServer bimServer) { try { Properties properties = new Properties(); String instanceName = "UniqueName" + Math.random(); properties.setProperty("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); properties.setProperty("org.quartz.threadPool.threadCount", "1"); properties.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instanceName); sf = new StdSchedulerFactory(properties); sched = sf.getScheduler(); sched.getContext().put("bimserver", bimServer); } catch (SchedulerException e) { LOGGER.error("", e); } }
private void initialize() throws SchedulerException { scheduler.getContext().put(DeadlineJob.TRANSACTION_MANAGER_KEY, transactionManager); scheduler.getContext().put(DeadlineJob.SCOPE_AWARE_RESOLVER, scopeAwareProvider); scheduler.getContext().put(DeadlineJob.JOB_DATA_SERIALIZER, serializer); scheduler.getContext().put(DeadlineJob.HANDLER_INTERCEPTORS, handlerInterceptors()); }
private void createAndInitScheduler() throws SchedulerException { LOG.info("Create and initializing scheduler."); scheduler = createScheduler(); SchedulerContext quartzContext = storeCamelContextInQuartzContext(); // Set camel job counts to zero. We needed this to prevent shutdown in case there are multiple Camel contexts // that has not completed yet, and the last one with job counts to zero will eventually shutdown. AtomicInteger number = (AtomicInteger) quartzContext.get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT); if (number == null) { number = new AtomicInteger(0); quartzContext.put(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT, number); } }
@Override protected Scheduler instantiate(QuartzSchedulerResources rcs, QuartzScheduler qs) { try { ((JCRJobStore)rcs.getJobStore()).init(session, moduleConfigPath); qs.getSchedulerContext().put(Session.class.getName(), session); return new JCRScheduler(qs); } catch (SchedulerException e) { throw new RuntimeException("Unexpected exception creating scheduler", e); } } }