org.quartz.Scheduler.getListenerManager()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(270)

本文整理了Java中org.quartz.Scheduler.getListenerManager()方法的一些代码示例,展示了Scheduler.getListenerManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.getListenerManager()方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:getListenerManager

Scheduler.getListenerManager介绍

[英]Get a reference to the scheduler's ListenerManager, through which listeners may be registered.
[中]获取对调度程序ListenerManager的引用,通过它可以注册侦听器。

代码示例

代码示例来源:origin: quartz-scheduler/quartz

/**
 * <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());
}

代码示例来源:origin: quartz-scheduler/quartz

/**
 * <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());
}

代码示例来源:origin: quartz-scheduler/quartz

/**
 * <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());
}

代码示例来源:origin: quartz-scheduler/quartz

/**
 * <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());
}

代码示例来源:origin: quartz-scheduler/quartz

@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);
}

代码示例来源:origin: quartz-scheduler/quartz

@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);
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Register all specified listeners with the Scheduler.
 */
protected void registerListeners() throws SchedulerException {
  ListenerManager listenerManager = getScheduler().getListenerManager();
  if (this.schedulerListeners != null) {
    for (SchedulerListener listener : this.schedulerListeners) {
      listenerManager.addSchedulerListener(listener);
    }
  }
  if (this.globalJobListeners != null) {
    for (JobListener listener : this.globalJobListeners) {
      listenerManager.addJobListener(listener);
    }
  }
  if (this.globalTriggerListeners != null) {
    for (TriggerListener listener : this.globalTriggerListeners) {
      listenerManager.addTriggerListener(listener);
    }
  }
}

代码示例来源:origin: org.springframework/spring-context-support

/**
 * Register all specified listeners with the Scheduler.
 */
protected void registerListeners() throws SchedulerException {
  ListenerManager listenerManager = getScheduler().getListenerManager();
  if (this.schedulerListeners != null) {
    for (SchedulerListener listener : this.schedulerListeners) {
      listenerManager.addSchedulerListener(listener);
    }
  }
  if (this.globalJobListeners != null) {
    for (JobListener listener : this.globalJobListeners) {
      listenerManager.addJobListener(listener);
    }
  }
  if (this.globalTriggerListeners != null) {
    for (TriggerListener listener : this.globalTriggerListeners) {
      listenerManager.addTriggerListener(listener);
    }
  }
}

代码示例来源:origin: elasticjob/elastic-job-lite

private Scheduler createScheduler() {
  Scheduler result;
  try {
    StdSchedulerFactory factory = new StdSchedulerFactory();
    factory.initialize(getBaseQuartzProperties());
    result = factory.getScheduler();
    result.getListenerManager().addTriggerListener(schedulerFacade.newJobTriggerListener());
  } catch (final SchedulerException ex) {
    throw new JobSystemException(ex);
  }
  return result;
}

代码示例来源:origin: myschedule/myschedule-quartz-extra

public ListenerManager getListenerManager() {
  try {
    return scheduler.getListenerManager();
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: com.gitblit.fathom/fathom-quartz

/**
 * Sets the {@code JobListener}s.
 *
 * @param jobListeners The {@code JobListener}s
 * @throws SchedulerException If any error occurs
 */
@Inject(optional = true)
public void addJobListeners(Set<JobListener> jobListeners) throws SchedulerException {
  for (JobListener jobListener : jobListeners) {
    scheduler.getListenerManager().addJobListener(jobListener);
  }
}

代码示例来源:origin: com.gitblit.fathom/fathom-quartz

/**
 * Sets the {@code TriggerListener}s.
 *
 * @param triggerListeners The {@code TriggerListener}s
 * @throws SchedulerException If any error occurs
 */
@Inject(optional = true)
public void addTriggerListeners(Set<TriggerListener> triggerListeners) throws SchedulerException {
  for (TriggerListener triggerListener : triggerListeners) {
    scheduler.getListenerManager().addTriggerListener(triggerListener);
  }
}

代码示例来源:origin: myschedule/myschedule-quartz-extra

@SuppressWarnings("unchecked")
public void addJobListener(JobListener listener) {
  try {
    scheduler.getListenerManager().addJobListener(listener);
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: sakaiproject/sakai

public void destroy() throws SchedulerException {
  log.info("destroy()");
  ListenerManager listenerManager = schedulerFactory.getScheduler().getListenerManager();
  listenerManager.removeTriggerListener(triggerListener.getName());
}

代码示例来源:origin: org.sakaiproject.scheduler/scheduler-component-shared

public void destroy() throws SchedulerException {
  log.info("destroy()");
  ListenerManager listenerManager = schedulerFactory.getScheduler().getListenerManager();
  listenerManager.removeTriggerListener(triggerListener.getName());
}

代码示例来源:origin: sakaiproject/sakai

public void init() throws SchedulerException {
  log.info("init()");
  triggerListener = new ContextTriggerListener("ContextTriggerListener");
  ListenerManager listenerManager = schedulerFactory.getScheduler().getListenerManager();
  // Just filter on our group.
  listenerManager.addTriggerListener(triggerListener, GroupMatcher.triggerGroupEquals(GROUP_NAME));
}

代码示例来源:origin: com.threewks.thundr/thundr-quartz

@Override
public ListenerManager getListenerManager() throws QuartzException {
  try {
    return delegate.getListenerManager();
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: org.sakaiproject.scheduler/scheduler-component-shared

public void init() throws SchedulerException {
  log.info("init()");
  triggerListener = new ContextTriggerListener("ContextTriggerListener");
  ListenerManager listenerManager = schedulerFactory.getScheduler().getListenerManager();
  // Just filter on our group.
  listenerManager.addTriggerListener(triggerListener, GroupMatcher.triggerGroupEquals(GROUP_NAME));
}

代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz

@Override
public ListenerManager getListenerManager() throws QuartzException {
  try {
    return delegate.getListenerManager();
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: com.dangdang/elastic-job-lite-core

private Scheduler createScheduler() {
  Scheduler result;
  try {
    StdSchedulerFactory factory = new StdSchedulerFactory();
    factory.initialize(getBaseQuartzProperties());
    result = factory.getScheduler();
    result.getListenerManager().addTriggerListener(schedulerFacade.newJobTriggerListener());
  } catch (final SchedulerException ex) {
    throw new JobSystemException(ex);
  }
  return result;
}

相关文章