public void addJobListener(JobListener jobListener, List<Matcher<JobKey>> matchers) { if (jobListener.getName() == null || jobListener.getName().length() == 0) { throw new IllegalArgumentException( "JobListener name cannot be empty."); } synchronized (globalJobListeners) { globalJobListeners.put(jobListener.getName(), jobListener); LinkedList<Matcher<JobKey>> matchersL = new LinkedList<Matcher<JobKey>>(); if(matchers != null && matchers.size() > 0) matchersL.addAll(matchers); else matchersL.add(EverythingMatcher.allJobs()); globalJobListenersMatchers.put(jobListener.getName(), matchersL); } }
public void addJobListener(JobListener jobListener, Matcher<JobKey> matcher) { if (jobListener.getName() == null || jobListener.getName().length() == 0) { throw new IllegalArgumentException( "JobListener name cannot be empty."); } synchronized (globalJobListeners) { globalJobListeners.put(jobListener.getName(), jobListener); LinkedList<Matcher<JobKey>> matchersL = new LinkedList<Matcher<JobKey>>(); if(matcher != null) matchersL.add(matcher); else matchersL.add(EverythingMatcher.allJobs()); globalJobListenersMatchers.put(jobListener.getName(), matchersL); } }
public void addTriggerListener(TriggerListener triggerListener, List<Matcher<TriggerKey>> matchers) { if (triggerListener.getName() == null || triggerListener.getName().length() == 0) { throw new IllegalArgumentException( "TriggerListener name cannot be empty."); } synchronized (globalTriggerListeners) { globalTriggerListeners.put(triggerListener.getName(), triggerListener); LinkedList<Matcher<TriggerKey>> matchersL = new LinkedList<Matcher<TriggerKey>>(); if(matchers != null && matchers.size() > 0) matchersL.addAll(matchers); else matchersL.add(EverythingMatcher.allTriggers()); globalTriggerListenersMatchers.put(triggerListener.getName(), matchersL); } }
@Override public void addGlobalJobListener(JobListener jobGlobalListener) throws SchedulerException { final Scheduler defaultScheduler; final List<Matcher<JobKey>> allJobs = new ArrayList<Matcher<JobKey>>(); allJobs.add(EverythingMatcher.allJobs()); if (Parameter.QUARTZ_DEFAULT_LISTENER_DISABLED.getValueAsBoolean()) { defaultScheduler = null; LOG.debug("Initialization of Quartz default listener has been disabled"); } else { defaultScheduler = StdSchedulerFactory.getDefaultScheduler(); defaultScheduler.getListenerManager().addJobListener(jobGlobalListener, allJobs); } for (final Scheduler scheduler : JobInformations.getAllSchedulers()) { if (scheduler != defaultScheduler) { scheduler.getListenerManager().addJobListener(jobGlobalListener, allJobs); } } }
protected void initInternal() { try { StdSchedulerFactory factory = new StdSchedulerFactory(); factory.initialize(QUARTZ_PROPERTY_FILE_NAME); scheduler = factory.getScheduler(); // Register job listener to bound request context to every job // execution scheduler.getListenerManager().addJobListener(jobListener, EverythingMatcher.allJobs()); // Replace default job factory scheduler.setJobFactory(jobFactory); } catch (SchedulerException ex) { throw new IllegalStateException("Failed to initialize Quartz scheduler manager", ex); } log.info("Quartz scheduler manager initialized"); }
void createJobDetail(Class<T> jobClass, InternalFSM fsm, Map<String, Object> additionalJobData) throws SchedulerException { JobDataMap map = new JobDataMap(); map.put(FireEventTimeJob.FSM_KEY, fsm); if(additionalJobData != null) { for(Entry<String, Object> entry : additionalJobData.entrySet()) map.put(entry.getKey(), entry.getValue()); } jobKey = new JobKey(UUID.randomUUID().toString()); jobDetail = JobBuilder.newJob(jobClass).usingJobData(map).withIdentity(jobKey).build(); scheduler.getListenerManager().addTriggerListener(clearTriggerData, EverythingMatcher.allTriggers()); }
public void addJobListener(JobListener jobListener) { addJobListener(jobListener, EverythingMatcher.allJobs()); }
public void addTriggerListener(TriggerListener triggerListener) { addTriggerListener(triggerListener, EverythingMatcher.allTriggers()); }
public void initialize(String pname, Scheduler scheduler, ClassLoadHelper classLoadHelper) throws SchedulerException { this.name = pname; this.scheduler = scheduler; scheduler.getListenerManager().addJobListener(this, EverythingMatcher.allJobs()); }
/** * <p> * Called during creation of the <code>Scheduler</code> in order to give * the <code>SchedulerPlugin</code> a chance to initialize. * </p> * * @throws SchedulerConfigException * if there is an error initializing. */ public void initialize(String pname, Scheduler scheduler, ClassLoadHelper classLoadHelper) throws SchedulerException { this.name = pname; scheduler.getListenerManager().addTriggerListener(this, EverythingMatcher.allTriggers()); }
/** * <p> * Called during creation of the <code>Scheduler</code> in order to give * the <code>SchedulerPlugin</code> a chance to initialize. * </p> * * @throws SchedulerConfigException * if there is an error initializing. */ public void initialize(String pname, Scheduler scheduler,ClassLoadHelper classLoadHelper) throws SchedulerException { this.name = pname; scheduler.getListenerManager().addJobListener(this, EverythingMatcher.allJobs()); }