Java 类org.quartz.spi.ThreadExecutor 实例源码

项目:lams    文件:QuartzScheduler.java   
/**
 * <p>
 * Create a <code>QuartzScheduler</code> with the given configuration
 * properties.
 * </p>
 * 
 * @see QuartzSchedulerResources
 */
public QuartzScheduler(QuartzSchedulerResources resources, long idleWaitTime, @Deprecated long dbRetryInterval)
    throws SchedulerException {
    this.resources = resources;
    if (resources.getJobStore() instanceof JobListener) {
        addInternalJobListener((JobListener)resources.getJobStore());
    }

    this.schedThread = new QuartzSchedulerThread(this, resources);
    ThreadExecutor schedThreadExecutor = resources.getThreadExecutor();
    schedThreadExecutor.execute(this.schedThread);
    if (idleWaitTime > 0) {
        this.schedThread.setIdleWaitTime(idleWaitTime);
    }

    jobMgr = new ExecutingJobsManager();
    addInternalJobListener(jobMgr);
    errLogger = new ErrorLogger();
    addInternalSchedulerListener(errLogger);

    signaler = new SchedulerSignalerImpl(this, this.schedThread);

    if(shouldRunUpdateCheck()) 
        updateTimer = scheduleUpdateCheck();
    else
        updateTimer = null;

    getLog().info("Quartz Scheduler v." + getVersion() + " created.");
}
项目:asura    文件:QuartzScheduler.java   
/**
 * <p>
 * Create a <code>QuartzScheduler</code> with the given configuration
 * properties.
 * </p>
 * 
 * @see QuartzSchedulerResources
 */
public QuartzScheduler(QuartzSchedulerResources resources,
        SchedulingContext ctxt, long idleWaitTime, long dbRetryInterval)
    throws SchedulerException {
    this.resources = resources;

    this.schedThread = new QuartzSchedulerThread(this, resources, ctxt);
    ThreadExecutor schedThreadExecutor = resources.getThreadExecutor();
    schedThreadExecutor.execute(this.schedThread);
    if (idleWaitTime > 0) {
        this.schedThread.setIdleWaitTime(idleWaitTime);
    }
    if (dbRetryInterval > 0) {
        this.schedThread.setDbFailureRetryInterval(dbRetryInterval);
    }

    jobMgr = new ExecutingJobsManager();
    addGlobalJobListener(jobMgr);
    errLogger = new ErrorLogger();
    addSchedulerListener(errLogger);

    signaler = new SchedulerSignalerImpl(this, this.schedThread);

    if(shouldRunUpdateCheck()) 
        updateTimer = scheduleUpdateCheck();
    else
        updateTimer = null;

    this.dbRetryInterval = dbRetryInterval;

    getLog().info("Quartz Scheduler v." + getVersion() + " created.");

}
项目:nexus-public    文件:QuartzSchedulerSPI.java   
/**
 * Create a new {@link Scheduler} and set to stand-by mode.
 */
private Scheduler createScheduler() throws SchedulerException {
  // ensure executed threads have TCCL set
  ThreadExecutor threadExecutor = new DefaultThreadExecutor()
  {
    @Override
    public void execute(final Thread thread) {
      thread.setContextClassLoader(QuartzSchedulerSPI.class.getClassLoader());
      super.execute(thread);
    }
  };

  // create Scheduler (implicitly registers it with repository)
  DirectSchedulerFactory.getInstance().createScheduler(
      SCHEDULER_NAME,
      nodeAccess.getId(), // instance-id
      new QuartzThreadPool(threadPoolSize),
      threadExecutor,
      jobStoreProvider.get(),
      null, // scheduler plugin-map
      null, // rmi-registry host
      0,    // rmi-registry port
      -1,   // idle-wait time
      -1,   // db-failure retry-interval
      true, // jmx-export
      null, // custom jmx object-name, lets use the default
      1,    // max batch-size
      0L    // batch time-window
  );
  Scheduler scheduler = DirectSchedulerFactory.getInstance().getScheduler(SCHEDULER_NAME);
  scheduler.setJobFactory(jobFactory);

  // re-logging with version, as by default we limit quartz logging to WARN, hiding its default version logging
  log.info("Quartz Scheduler v{}", scheduler.getMetaData().getVersion());

  scheduler.standby();

  return scheduler;
}
项目:lams    文件:JobStoreSupport.java   
public void setThreadExecutor(ThreadExecutor threadExecutor) {
    this.threadExecutor = threadExecutor;
}
项目:lams    文件:JobStoreSupport.java   
public ThreadExecutor getThreadExecutor() {
    return threadExecutor;
}
项目:lams    文件:JobStoreSupport.java   
public void initialize() {
    this.manage();

    ThreadExecutor executor = getThreadExecutor();
    executor.execute(ClusterManager.this);
}
项目:lams    文件:JobStoreSupport.java   
public void initialize() {
    ThreadExecutor executor = getThreadExecutor();
    executor.execute(MisfireHandler.this);
}
项目:lams    文件:QuartzSchedulerResources.java   
/**
 * Get the ThreadExecutor which runs the QuartzSchedulerThread
 */
public ThreadExecutor getThreadExecutor() {
    return threadExecutor;
}
项目:lams    文件:QuartzSchedulerResources.java   
/**
 * Set the ThreadExecutor which runs the QuartzSchedulerThread
 */
public void setThreadExecutor(ThreadExecutor threadExecutor) {
    this.threadExecutor = threadExecutor;
}
项目:asura    文件:JobStoreSupport.java   
public void setThreadExecutor(ThreadExecutor threadExecutor) {
    this.threadExecutor = threadExecutor;
}
项目:asura    文件:JobStoreSupport.java   
public ThreadExecutor getThreadExecutor() {
    return threadExecutor;
}
项目:asura    文件:JobStoreSupport.java   
public void initialize() {
    this.manage();

    ThreadExecutor executor = getThreadExecutor();
    executor.execute(ClusterManager.this);
}
项目:asura    文件:JobStoreSupport.java   
public void initialize() {
    ThreadExecutor executor = getThreadExecutor();
    executor.execute(MisfireHandler.this);
}
项目:lams    文件:DirectSchedulerFactory.java   
/**
 * Creates a scheduler using the specified thread pool, job store, and
 * plugins, and binds it to RMI.
 *
 * @param schedulerName
 *          The name for the scheduler.
 * @param schedulerInstanceId
 *          The instance ID for the scheduler.
 * @param threadPool
 *          The thread pool for executing jobs
 * @param threadExecutor
 *          The thread executor for executing jobs
 * @param jobStore
 *          The type of job store
 * @param schedulerPluginMap
 *          Map from a <code>String</code> plugin names to
 *          <code>{@link org.quartz.spi.SchedulerPlugin}</code>s.  Can use
 *          "null" if no plugins are required.
 * @param rmiRegistryHost
 *          The hostname to register this scheduler with for RMI. Can use
 *          "null" if no RMI is required.
 * @param rmiRegistryPort
 *          The port for RMI. Typically 1099.
 * @param idleWaitTime
 *          The idle wait time in milliseconds. You can specify "-1" for
 *          the default value, which is currently 30000 ms.
 * @throws SchedulerException
 *           if initialization failed
 */
public void createScheduler(String schedulerName,
        String schedulerInstanceId, ThreadPool threadPool,
        ThreadExecutor threadExecutor,
        JobStore jobStore, Map<String, SchedulerPlugin> schedulerPluginMap,
        String rmiRegistryHost, int rmiRegistryPort,
        long idleWaitTime, long dbFailureRetryInterval,
        boolean jmxExport, String jmxObjectName)
    throws SchedulerException {
    createScheduler(schedulerName, schedulerInstanceId, threadPool,
            DEFAULT_THREAD_EXECUTOR, jobStore, schedulerPluginMap,
            rmiRegistryHost, rmiRegistryPort, idleWaitTime,
            dbFailureRetryInterval, jmxExport, jmxObjectName, DEFAULT_BATCH_MAX_SIZE, DEFAULT_BATCH_TIME_WINDOW);
}
项目:asura    文件:QuartzSchedulerResources.java   
/**
 * Get the ThreadExecutor which runs the QuartzSchedulerThread
 * 
 * @return
 */
public ThreadExecutor getThreadExecutor() {
    return threadExecutor;
}
项目:asura    文件:QuartzSchedulerResources.java   
/**
 * Set the ThreadExecutor which runs the QuartzSchedulerThread
 *
 * @param threadExecutor
 */
public void setThreadExecutor(ThreadExecutor threadExecutor) {
    this.threadExecutor = threadExecutor;
}