Package org.quartz.impl

Examples of org.quartz.impl.DirectSchedulerFactory


        // create the pool
        this.threadPool = tpm.get(poolName);
        final QuartzThreadPool quartzPool = new QuartzThreadPool(this.threadPool);

        final DirectSchedulerFactory factory = DirectSchedulerFactory.getInstance();
        // unique run id
        final String runID = new Date().toString().replace(' ', '_');
        factory.createScheduler(QUARTZ_SCHEDULER_NAME, runID, quartzPool, new RAMJobStore());
        // quartz does not provide a way to get the scheduler by name AND runID, so we have to iterate!
        final Iterator<org.quartz.Scheduler> allSchedulersIter = factory.getAllSchedulers().iterator();
        org.quartz.Scheduler s = null;
        while ( s == null && allSchedulersIter.hasNext() ) {
            final org.quartz.Scheduler current = allSchedulersIter.next();
            if ( QUARTZ_SCHEDULER_NAME.equals(current.getSchedulerName())
                 && runID.equals(current.getSchedulerInstanceId()) ) {
View Full Code Here


            final SchedulerFactory factory = new StdSchedulerFactory();
            this.scheduler = factory.getScheduler();
        } else {
            final ThreadPool pool = tpm.get(THREAD_POOL_NAME);
            final QuartzThreadPool quartzPool = new QuartzThreadPool(pool);
            final DirectSchedulerFactory factory = DirectSchedulerFactory.getInstance();
            factory.createScheduler(quartzPool, new RAMJobStore());
            this.scheduler = factory.getScheduler();
        }
        this.scheduler.start();
        if ( this.logger.isDebugEnabled() ) {
            this.logger.debug("Scheduler started.");
        }
View Full Code Here

            final SchedulerFactory factory = new StdSchedulerFactory();
            this.scheduler = factory.getScheduler();
        } else {
            final ThreadPool pool = tpm.get(THREAD_POOL_NAME);
            final QuartzThreadPool quartzPool = new QuartzThreadPool(pool);
            final DirectSchedulerFactory factory = DirectSchedulerFactory.getInstance();
            factory.createScheduler(quartzPool, new RAMJobStore());
            this.scheduler = factory.getScheduler();
        }
        this.scheduler.start();
        if ( this.logger.isDebugEnabled() ) {
            this.logger.debug("Scheduler started.");
        }
View Full Code Here

    @Transient
    public Scheduler getScheduler() {
        Scheduler s = null;

        try {
            DirectSchedulerFactory fact = DirectSchedulerFactory.getInstance();

            if (fact.getScheduler(schedulerName) == null) {
                fact.createRemoteScheduler(schedulerName == null
                        || schedulerName.isEmpty() ? "QuartzScheduler"
                        : schedulerName, schedulerInstanceId == null
                        || schedulerInstanceId.isEmpty() ? "NON_CLUSTERED"
                        : schedulerInstanceId, rmiHost, rmiPort);
            }

            s = fact.getScheduler(schedulerName == null ? "QuartzScheduler"
                    : schedulerName);
        } catch (SchedulerException ex) {
            log.log(Level.SEVERE, "Could not retrieve Scheduler for config!", ex);
        }
View Full Code Here

  @Transient
  public Scheduler getScheduler() {
    Scheduler s = null;

    try {
      DirectSchedulerFactory fact = DirectSchedulerFactory.getInstance();

      if (fact.getScheduler(schedulerName) == null) {
        fact.createRemoteScheduler(schedulerName == null
            || schedulerName.isEmpty() ? "QuartzScheduler"
            : schedulerName, schedulerInstanceId == null
            || schedulerInstanceId.isEmpty() ? "NON_CLUSTERED"
            : schedulerInstanceId, rmiHost, rmiPort);
      }

      s = fact.getScheduler(schedulerName == null ? "QuartzScheduler"
          : schedulerName);
    } catch (SchedulerException ex) {
      log.log(Level.SEVERE, "Could not retrieve Scheduler for config!",
          ex);
    }
View Full Code Here

        try {
            threadPool.initialize();
        } catch (SchedulerConfigException ex) {
            throw new CronProviderInitialisationException("Error initializing Quartz ThreadPool", ex);
        }
        final DirectSchedulerFactory schedulerFactory = DirectSchedulerFactory.getInstance();
        schedulerName = SCHEDULER_NAME_PREFIX + "_" + instanceId.toString();
        try {
            schedulerFactory.createScheduler(schedulerName, instanceId.toString(), threadPool, jobStore);
            scheduler = schedulerFactory.getScheduler(schedulerName);
            scheduler.start();
        } catch (SchedulerException ex) {
            throw new CronProviderInitialisationException("Error initializing Quartz scheduler", ex);
        }
    }
View Full Code Here

        try {
            instanceId = UUID.randomUUID();
            JobStore jobStore = new RAMJobStore();
            ThreadPool threadPool = new SimpleThreadPool(4, Thread.NORM_PRIORITY);
            threadPool.initialize();
            final DirectSchedulerFactory schedulerFactory = DirectSchedulerFactory.getInstance();
            schedulerName = SCHEDULER_NAME_PREFIX + "_" + instanceId.toString();
            schedulerFactory.createScheduler(schedulerName, instanceId.toString(), threadPool, jobStore);
            scheduler = schedulerFactory.getScheduler(schedulerName);
            scheduler.start();
        } catch (SchedulerException ex) {
            throw new CronProviderInitialisationException("Error initialising Quartz for asynchronous method invocation");
        }
    }
View Full Code Here

    public QuartzScheduler(ThreadPool threadPool) throws SchedulerException {
        // SLING-2261 Prevent Quartz from checking for updates
        System.setProperty("org.terracotta.quartz.skipUpdateCheck", Boolean.TRUE.toString());

        final DirectSchedulerFactory factory = DirectSchedulerFactory.getInstance();
        // unique run id
        final String runID = new Date().toString().replace(' ', '_');
        factory.createScheduler(QUARTZ_SCHEDULER_NAME, runID, threadPool, new RAMJobStore());
        // quartz does not provide a way to get the scheduler by name AND runID, so we have to iterate!
        final Iterator<org.quartz.Scheduler> allSchedulersIter = factory.getAllSchedulers().iterator();
        while ( scheduler == null && allSchedulersIter.hasNext() ) {
            final org.quartz.Scheduler current = allSchedulersIter.next();
            if ( QUARTZ_SCHEDULER_NAME.equals(current.getSchedulerName())
                    && runID.equals(current.getSchedulerInstanceId()) ) {
                scheduler = current;
View Full Code Here

TOP

Related Classes of org.quartz.impl.DirectSchedulerFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.