org.quartz.spi.JobStore Java Examples

The following examples show how to use org.quartz.spi.JobStore. 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: QuartzSchedulerSPI.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("squid:S00107") //suppress constructor parameter count
@Inject
public QuartzSchedulerSPI(final EventManager eventManager,
                          final NodeAccess nodeAccess,
                          final Provider<JobStore> jobStoreProvider,
                          final Provider<Scheduler> schedulerProvider,
                          final LastShutdownTimeService lastShutdownTimeService,
                          final DatabaseStatusDelayedExecutor delayedExecutor,
                          @Named("${nexus.quartz.recoverInterruptedJobs:-true}") final boolean recoverInterruptedJobs)
{
  this.eventManager = checkNotNull(eventManager);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.jobStoreProvider = checkNotNull(jobStoreProvider);
  this.schedulerProvider = checkNotNull(schedulerProvider);
  this.lastShutdownTimeService = checkNotNull(lastShutdownTimeService);
  this.recoverInterruptedJobs = recoverInterruptedJobs;
  this.delayedExecutor = checkNotNull(delayedExecutor);

  this.scheduleFactory = new QuartzScheduleFactory();
  this.triggerConverter = new QuartzTriggerConverter(this.scheduleFactory);

  // FIXME: sort out with refinement to lifecycle below
  this.active = true;
}
 
Example #2
Source File: JobStoreJdbcStoreProviderTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected JobStore createJobStore(final String name) {
  jobStore = new JobStoreJdbcProvider(new ConfigStoreConnectionProvider(sessionRule)).get();
  jobStore.setInstanceId("SINGLE_NODE_TEST");
  jobStore.setInstanceName(name);

  return jobStore;
}
 
Example #3
Source File: AbstractJobStoreTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testAcquireTriggersInBatch() throws Exception {
  SchedulerSignaler schedSignaler = new SampleSignaler();
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  JobStore store = createJobStore("testAcquireTriggersInBatch");
  store.initialize(loadHelper, schedSignaler);

  // Setup: Store jobs and triggers.
  long MIN = 60 * 1000L;
  Date startTime0 = new Date(System.currentTimeMillis() + MIN); // a min from now.
  for (int i=0; i < 10; i++) {
    Date startTime = new Date(startTime0.getTime() + i * MIN); // a min apart
    JobDetail job = JobBuilder.newJob(MyJob.class).withIdentity("job" + i).build();
    SimpleScheduleBuilder schedule = SimpleScheduleBuilder.repeatMinutelyForever(2);
    OperableTrigger trigger = (OperableTrigger)TriggerBuilder.newTrigger().withIdentity("job" + i).withSchedule(schedule).forJob(job).startAt(startTime).build();

    // Manually trigger the first fire time computation that scheduler would do. Otherwise
    // the store.acquireNextTriggers() will not work properly.
    Date fireTime = trigger.computeFirstFireTime(null);
    Assert.assertEquals(true, fireTime != null);

    store.storeJobAndTrigger(job, trigger);
  }

  // Test acquire batch of triggers at a time
  long noLaterThan = startTime0.getTime() + 10 * MIN;
  int maxCount = 7;
  // time window needs to be big to be able to pick up multiple triggers when they are a minute apart
  long timeWindow = 8 * MIN;
  List<OperableTrigger> triggers = store.acquireNextTriggers(noLaterThan, maxCount, timeWindow);
  Assert.assertEquals(7, triggers.size());
  for (int i=0; i < 7; i++) {
    Assert.assertEquals("job" + i, triggers.get(i).getKey().getName());
  }
}
 
Example #4
Source File: AbstractJobStoreTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testAcquireTriggers() throws Exception {
  SchedulerSignaler schedSignaler = new SampleSignaler();
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  JobStore store = createJobStore("testAcquireTriggers");
  store.initialize(loadHelper, schedSignaler);

  // Setup: Store jobs and triggers.
  long MIN = 60 * 1000L;
  Date startTime0 = new Date(System.currentTimeMillis() + MIN); // a min from now.
  for (int i=0; i < 10; i++) {
    Date startTime = new Date(startTime0.getTime() + i * MIN); // a min apart
    JobDetail job = JobBuilder.newJob(MyJob.class).withIdentity("job" + i).build();
    SimpleScheduleBuilder schedule = SimpleScheduleBuilder.repeatMinutelyForever(2);
    OperableTrigger trigger = (OperableTrigger)TriggerBuilder.newTrigger().withIdentity("job" + i).withSchedule(schedule).forJob(job).startAt(startTime).build();

    // Manually trigger the first fire time computation that scheduler would do. Otherwise
    // the store.acquireNextTriggers() will not work properly.
    Date fireTime = trigger.computeFirstFireTime(null);
    Assert.assertEquals(true, fireTime != null);

    store.storeJobAndTrigger(job, trigger);
  }

  // Test acquire one trigger at a time
  for (int i=0; i < 10; i++) {
    long noLaterThan = (startTime0.getTime() + i * MIN);
    int maxCount = 1;
    long timeWindow = 0;
    List<OperableTrigger> triggers = store.acquireNextTriggers(noLaterThan, maxCount, timeWindow);
    Assert.assertEquals(1, triggers.size());
    Assert.assertEquals("job" + i, triggers.get(0).getKey().getName());

    // Let's remove the trigger now.
    store.removeJob(triggers.get(0).getJobKey());
  }
}
 
Example #5
Source File: JobStoreJdbcOrientProviderTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected JobStore createJobStore(String name) {
  jobStore = new JobStoreJdbcProvider(new ConfigOrientConnectionProvider(database.getInstanceProvider())).get();
  jobStore.setInstanceId("SINGLE_NODE_TEST");
  jobStore.setInstanceName(name);

  return jobStore;
}
 
Example #6
Source File: QuartzSchedulerProvider.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public QuartzSchedulerProvider(final NodeAccess nodeAccess,
                               final Provider<JobStore> jobStore,
                               final JobFactory jobFactory,
                               @Named("${nexus.quartz.poolSize:-20}") final int threadPoolSize,
                               @Named("${nexus.quartz.taskThreadPriority:-5}") final int threadPriority)
{
  this.nodeAccess = checkNotNull(nodeAccess);
  this.jobStore = checkNotNull(jobStore);
  this.jobFactory = checkNotNull(jobFactory);
  checkArgument(threadPoolSize > 0, "Invalid thread-pool size: %s", threadPoolSize);
  this.threadPoolSize = threadPoolSize;
  this.threadPriority = threadPriority;
  log.info("Thread-pool size: {}, Thread-pool priority: {}", threadPoolSize, threadPriority);
}
 
Example #7
Source File: DirectSchedulerFactory.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an in memory job store (<code>{@link RAMJobStore}</code>)
 * The thread priority is set to Thread.NORM_PRIORITY
 *
 * @param maxThreads
 *          The number of threads in the thread pool
 * @throws SchedulerException
 *           if initialization failed.
 */
public void createVolatileScheduler(int maxThreads)
    throws SchedulerException {
    SimpleThreadPool threadPool = new SimpleThreadPool(maxThreads,
            Thread.NORM_PRIORITY);
    threadPool.initialize();
    JobStore jobStore = new RAMJobStore();
    this.createScheduler(threadPool, jobStore);

}
 
Example #8
Source File: JobStoreJdbcProvider.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private JobStore createJobStore() {
  try {
    connectionProvider.initialize();
    DBConnectionManager.getInstance().addConnectionProvider(QUARTZ_DS, connectionProvider);
    JobStoreTX delegate = new JobStoreTX();
    delegate.setDataSource(QUARTZ_DS);
    delegate.setDriverDelegateClass(getDriverDelegateClass());
    return delegate;
  }
  catch (Exception e) {
    log.error("Unable create job store", e);
    return null;
  }
}
 
Example #9
Source File: JobStoreJdbcProvider.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public JobStore get() {
  JobStore localRef = jobStore;
  if (localRef == null) {
    synchronized (this) {
      localRef = jobStore;
      if (localRef == null) {
        jobStore = localRef = createJobStore();
      }
    }
  }
  return localRef;
}
 
Example #10
Source File: AlfrescoSchedulerFactory.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected Scheduler instantiate(QuartzSchedulerResources rsrcs, QuartzScheduler qs)
{
    Scheduler scheduler = super.instantiate(rsrcs, qs);
    JobStore jobStore = rsrcs.getJobStore();
    if (jobStore instanceof SchedulerAware)
    {
        ((SchedulerAware) jobStore).setScheduler(scheduler);
    }
    return scheduler;
}
 
Example #11
Source File: AbstractJobStoreTest.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Test
public void testMatchers() throws Exception {
  SchedulerSignaler schedSignaler = new SampleSignaler();
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
  loadHelper.initialize();

  JobStore store = createJobStore("testMatchers");
  store.initialize(loadHelper, schedSignaler);

  JobDetail job = JobBuilder.newJob(MyJob.class).withIdentity("job1", "aaabbbccc").build();
  store.storeJob(job, true);
  SimpleScheduleBuilder schedule = SimpleScheduleBuilder.simpleSchedule();
  Trigger trigger = TriggerBuilder.newTrigger().withIdentity("trig1", "aaabbbccc").withSchedule(schedule).forJob(job).build();
  store.storeTrigger((OperableTrigger) trigger, true);

  job = JobBuilder.newJob(MyJob.class).withIdentity("job1", "xxxyyyzzz").build();
  store.storeJob(job, true);
  schedule = SimpleScheduleBuilder.simpleSchedule();
  trigger = TriggerBuilder.newTrigger().withIdentity("trig1", "xxxyyyzzz").withSchedule(schedule).forJob(job).build();
  store.storeTrigger((OperableTrigger)trigger, true);

  job = JobBuilder.newJob(MyJob.class).withIdentity("job2", "xxxyyyzzz").build();
  store.storeJob(job, true);
  schedule = SimpleScheduleBuilder.simpleSchedule();
  trigger = TriggerBuilder.newTrigger().withIdentity("trig2", "xxxyyyzzz").withSchedule(schedule).forJob(job).build();
  store.storeTrigger((OperableTrigger)trigger, true);

  Set<JobKey> jkeys = store.getJobKeys(GroupMatcher.anyJobGroup());
  Assert.assertEquals("Wrong number of jobs found by anything matcher", 3, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupEquals("xxxyyyzzz"));
  Assert.assertEquals("Wrong number of jobs found by equals matcher", 2, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupEquals("aaabbbccc"));
  Assert.assertEquals("Wrong number of jobs found by equals matcher", 1, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupStartsWith("aa"));
  Assert.assertEquals("Wrong number of jobs found by starts with matcher", 1, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupStartsWith("xx"));
  Assert.assertEquals("Wrong number of jobs found by starts with matcher", 2, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupEndsWith("cc"));
  Assert.assertEquals("Wrong number of jobs found by ends with matcher", 1, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupEndsWith("zzz"));
  Assert.assertEquals("Wrong number of jobs found by ends with matcher", 2, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupContains("bc"));
  Assert.assertEquals("Wrong number of jobs found by contains with matcher", 1, jkeys.size());

  jkeys = store.getJobKeys(GroupMatcher.jobGroupContains("yz"));
  Assert.assertEquals("Wrong number of jobs found by contains with matcher", 2, jkeys.size());

  Set<TriggerKey> tkeys = store.getTriggerKeys(GroupMatcher.anyTriggerGroup());
  Assert.assertEquals("Wrong number of triggers found by anything matcher", 3, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupEquals("xxxyyyzzz"));
  Assert.assertEquals("Wrong number of triggers found by equals matcher", 2, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupEquals("aaabbbccc"));
  Assert.assertEquals("Wrong number of triggers found by equals matcher", 1, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupStartsWith("aa"));
  Assert.assertEquals("Wrong number of triggers found by starts with matcher", 1, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupStartsWith("xx"));
  Assert.assertEquals("Wrong number of triggers found by starts with matcher", 2, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupEndsWith("cc"));
  Assert.assertEquals("Wrong number of triggers found by ends with matcher", 1, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupEndsWith("zzz"));
  Assert.assertEquals("Wrong number of triggers found by ends with matcher", 2, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupContains("bc"));
  Assert.assertEquals("Wrong number of triggers found by contains with matcher", 1, tkeys.size());

  tkeys = store.getTriggerKeys(GroupMatcher.triggerGroupContains("yz"));
  Assert.assertEquals("Wrong number of triggers found by contains with matcher", 2, tkeys.size());

}
 
Example #12
Source File: TaskSchedulerHelper.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
public void init(@Nullable final Integer poolSize, @Nullable final JobFactory factory) throws Exception {
  eventManager = new SimpleEventManager();
  applicationDirectories = mock(ApplicationDirectories.class);
  baseUrlManager = mock(BaseUrlManager.class);
  nodeAccess = mock(NodeAccess.class);
  lastShutdownTimeService = mock(LastShutdownTimeService.class);
  statusDelayedExecutor = mock(DatabaseStatusDelayedExecutor.class);

  Module module = binder -> {
    Properties properties = new Properties();
    properties.put("basedir", util.getBaseDir());
    if (poolSize != null) {
      properties.put("nexus.quartz.poolSize", poolSize);
    }
    binder.bind(ParameterKeys.PROPERTIES)
        .toInstance(properties);

    binder.bind(EventManager.class).toInstance(eventManager);

    File workDir = util.createTempDir(util.getTargetDir(), "workdir");
    when(applicationDirectories.getWorkDirectory(anyString())).thenReturn(workDir);
    binder.bind(ApplicationDirectories.class)
        .toInstance(applicationDirectories);

    binder.bind(BaseUrlManager.class)
        .toInstance(baseUrlManager);

    binder.bind(DatabaseInstance.class)
        .annotatedWith(Names.named("config"))
        .toInstance(databaseInstance);

    doAnswer(i  -> {
      ((Runnable) i.getArguments()[0]).run();
      return null;
    }).when(statusDelayedExecutor).execute(notNull(Runnable.class));
    binder.bind(DatabaseStatusDelayedExecutor.class)
        .toInstance(statusDelayedExecutor);

    when(nodeAccess.getId()).thenReturn("test-12345");
    when(nodeAccess.getMemberIds()).thenReturn(ImmutableSet.of("test-12345"));
    binder.bind(NodeAccess.class)
        .toInstance(nodeAccess);
    if (factory != null) {
      binder.bind(JobFactory.class).toInstance(factory);
    }

    binder.bind(LastShutdownTimeService.class).toInstance(lastShutdownTimeService);
    when(lastShutdownTimeService.estimateLastShutdownTime()).thenReturn(Optional.empty());

    // filtering by feature flag is not supported here yet
    binder.bind(JobStore.class).to(JobStoreImpl.class);
  };

  this.injector = Guice.createInjector(new WireModule(
      module, new StateGuardModule(),
      new SpaceModule(new URLClassSpace(TaskSchedulerHelper.class.getClassLoader()), BeanScanning.INDEX)
  ));
  injector.injectMembers(this);
}
 
Example #13
Source File: DirectSchedulerFactory.java    From AsuraFramework with Apache License 2.0 3 votes vote down vote up
/**
 * 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 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,
        JobStore jobStore, Map 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);
}
 
Example #14
Source File: QuartzSchedulerResources.java    From AsuraFramework with Apache License 2.0 3 votes vote down vote up
/**
 * <p>
 * Set the <code>{@link JobStore}</code> for the <code>{@link QuartzScheduler}</code>
 * to use.
 * </p>
 * 
 * @exception IllegalArgumentException
 *              if jobStore is null.
 */
public void setJobStore(JobStore jobStore) {
    if (jobStore == null) {
        throw new IllegalArgumentException("JobStore cannot be null.");
    }

    this.jobStore = jobStore;
}
 
Example #15
Source File: DirectSchedulerFactory.java    From AsuraFramework with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a scheduler using the specified thread pool and job store 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 jobStore
 *          The type of job store
 * @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,
        JobStore jobStore, String rmiRegistryHost, int rmiRegistryPort,
        long idleWaitTime, long dbFailureRetryInterval)
    throws SchedulerException {
    createScheduler(schedulerName,
            schedulerInstanceId, threadPool,
            jobStore, null, // plugins
            rmiRegistryHost, rmiRegistryPort,
            idleWaitTime, dbFailureRetryInterval,
            DEFAULT_JMX_EXPORT, DEFAULT_JMX_OBJECTNAME);
}
 
Example #16
Source File: DirectSchedulerFactory.java    From AsuraFramework with Apache License 2.0 3 votes vote down vote up
/**
 * Same as
 * {@link DirectSchedulerFactory#createScheduler(ThreadPool threadPool, JobStore jobStore)},
 * with the addition of specifying the scheduler name and instance ID. This
 * scheduler can only be retrieved via
 * {@link DirectSchedulerFactory#getScheduler(String)}
 *
 * @param schedulerName
 *          The name for the scheduler.
 * @param schedulerInstanceId
 *          The instance ID for the scheduler.
 * @param threadPool
 *          The thread pool for executing jobs
 * @param jobStore
 *          The type of job store
 * @throws SchedulerException
 *           if initialization failed
 */
public void createScheduler(String schedulerName,
        String schedulerInstanceId, ThreadPool threadPool, JobStore jobStore)
    throws SchedulerException {
    createScheduler(schedulerName, schedulerInstanceId, threadPool,
            jobStore, null, 0, -1, -1);
}
 
Example #17
Source File: DirectSchedulerFactory.java    From AsuraFramework with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a scheduler using the specified thread pool and job store. This
 * scheduler can be retrieved via
 * {@link DirectSchedulerFactory#getScheduler()}
 *
 * @param threadPool
 *          The thread pool for executing jobs
 * @param jobStore
 *          The type of job store
 * @throws SchedulerException
 *           if initialization failed
 */
public void createScheduler(ThreadPool threadPool, JobStore jobStore)
    throws SchedulerException {
    createScheduler(DEFAULT_SCHEDULER_NAME, DEFAULT_INSTANCE_ID,
            threadPool, jobStore);
    initialized = true;
}
 
Example #18
Source File: QuartzSchedulerResources.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>
 * Set the <code>{@link JobStore}</code> for the <code>{@link QuartzScheduler}</code>
 * to use.
 * </p>
 * 
 * @exception IllegalArgumentException
 *              if jobStore is null.
 */
public void setJobStore(JobStore jobStore) {
    if (jobStore == null) {
        throw new IllegalArgumentException("JobStore cannot be null.");
    }

    this.jobStore = jobStore;
}
 
Example #19
Source File: DirectSchedulerFactory.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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);
}
 
Example #20
Source File: DirectSchedulerFactory.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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 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,
        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);
}
 
Example #21
Source File: DirectSchedulerFactory.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a scheduler using the specified thread pool and job store 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 jobStore
 *          The type of job store
 * @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,
        JobStore jobStore, String rmiRegistryHost, int rmiRegistryPort,
        long idleWaitTime, long dbFailureRetryInterval)
    throws SchedulerException {
    createScheduler(schedulerName,
            schedulerInstanceId, threadPool,
            jobStore, null, // plugins
            rmiRegistryHost, rmiRegistryPort,
            idleWaitTime, dbFailureRetryInterval,
            DEFAULT_JMX_EXPORT, DEFAULT_JMX_OBJECTNAME);
}
 
Example #22
Source File: DirectSchedulerFactory.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Same as
 * {@link DirectSchedulerFactory#createScheduler(ThreadPool threadPool, JobStore jobStore)},
 * with the addition of specifying the scheduler name and instance ID. This
 * scheduler can only be retrieved via
 * {@link DirectSchedulerFactory#getScheduler(String)}
 *
 * @param schedulerName
 *          The name for the scheduler.
 * @param schedulerInstanceId
 *          The instance ID for the scheduler.
 * @param threadPool
 *          The thread pool for executing jobs
 * @param jobStore
 *          The type of job store
 * @throws SchedulerException
 *           if initialization failed
 */
public void createScheduler(String schedulerName,
        String schedulerInstanceId, ThreadPool threadPool, JobStore jobStore)
    throws SchedulerException {
    createScheduler(schedulerName, schedulerInstanceId, threadPool,
            jobStore, null, 0, -1, -1);
}
 
Example #23
Source File: DirectSchedulerFactory.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates an in memory job store (<code>{@link RAMJobStore}</code>)
 * The thread priority is set to Thread.NORM_PRIORITY
 *
 * @param maxThreads
 *          The number of threads in the thread pool
 * @throws SchedulerException
 *           if initialization failed.
 */
public void createVolatileScheduler(int maxThreads)
    throws SchedulerException {
    SimpleThreadPool threadPool = new SimpleThreadPool(maxThreads,
            Thread.NORM_PRIORITY);
    threadPool.initialize();
    JobStore jobStore = new RAMJobStore();
    this.createScheduler(threadPool, jobStore);
}
 
Example #24
Source File: QuartzSchedulerResources.java    From AsuraFramework with Apache License 2.0 2 votes vote down vote up
/**
 * <p>
 * Get the <code>{@link JobStore}</code> for the <code>{@link QuartzScheduler}</code>
 * to use.
 * </p>
 */
public JobStore getJobStore() {
    return jobStore;
}
 
Example #25
Source File: QuartzSchedulerResources.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>
 * Get the <code>{@link JobStore}</code> for the <code>{@link QuartzScheduler}</code>
 * to use.
 * </p>
 */
public JobStore getJobStore() {
    return jobStore;
}
 
Example #26
Source File: DirectSchedulerFactory.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a scheduler using the specified thread pool and job store. This
 * scheduler can be retrieved via
 * {@link DirectSchedulerFactory#getScheduler()}
 *
 * @param threadPool
 *          The thread pool for executing jobs
 * @param jobStore
 *          The type of job store
 * @throws SchedulerException
 *           if initialization failed
 */
public void createScheduler(ThreadPool threadPool, JobStore jobStore)
    throws SchedulerException {
    createScheduler(DEFAULT_SCHEDULER_NAME, DEFAULT_INSTANCE_ID,
            threadPool, jobStore);
}
 
Example #27
Source File: AbstractJobStoreTest.java    From nexus-public with Eclipse Public License 1.0 votes vote down vote up
protected abstract JobStore createJobStore(String name);