Package org.quartz

Examples of org.quartz.SchedulerFactory


    }


    private Scheduler createScheduler() throws SchedulerException
    {
        SchedulerFactory factory = new StdSchedulerFactory(withFactoryProperties());

        return factory.getScheduler();
    }
View Full Code Here


  /**
   * 创建定时任务工厂
   * @return
   */
  public static SchedulerFactory createSchedulerFactory() {
    SchedulerFactory sf = new StdSchedulerFactory();
    return sf;
  }
View Full Code Here

   * 根据传入的属性文件创建定时任务工厂
   * @param props
   * @return
   */
  public static SchedulerFactory createSchedulerFactory(Properties props) {
    SchedulerFactory sf = null;
    try {
      sf = new StdSchedulerFactory(props);
    } catch (SchedulerException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

        Logger log = LoggerFactory.getLogger(SimpleExample.class);

        log.info("------- Initializing ----------------------");

        // First we must get a reference to a scheduler
        SchedulerFactory sf = new StdSchedulerFactory();
        Scheduler sched = sf.getScheduler();

        log.info("------- Initialization Complete -----------");

        // computer a time that is on the next round minute
        Date runTime = evenMinuteDate(new Date());
View Full Code Here

        Logger log = LoggerFactory.getLogger(CronTriggerExample.class);

        log.info("------- Initializing -------------------");

        // First we must get a reference to a scheduler
        SchedulerFactory sf = new StdSchedulerFactory();
        Scheduler sched = sf.getScheduler();

        log.info("------- Initialization Complete --------");

        log.info("------- Scheduling Jobs ----------------");
View Full Code Here

import com.founder.fix.fixflow.core.impl.util.QuartzUtil;

public class Test {
  public void task() throws SchedulerException {
    SchedulerFactory schedulerFactory = QuartzUtil.createSchedulerFactory();
    Scheduler scheduler = QuartzUtil.getScheduler(schedulerFactory);
    Trigger tg = QuartzUtil.getTrigger(scheduler, "mytrigger");
    ((SimpleTrigger)tg).getRepeatCount();
        // reschedule the job
        scheduler.rescheduleJob(new TriggerKey("mytrigger"), tg);
View Full Code Here

public class ScheduleServiceTest extends AbstractFixFlowTestCase {
 
 
  public void testGetSchedulerFactory() throws SchedulerException{
    SchedulerFactory schedulerFactory=scheduleService.getSchedulerFactory();
    Scheduler scheduler=schedulerFactory.getScheduler();
    //获得到 scheduler 之后就能对定时任务框架进行操作 具体操作方式请参见 quartz 使用手册
    assertNotNull(scheduler);
  }
View Full Code Here

        }
        return answer;
    }

    protected SchedulerFactory createSchedulerFactory() throws SchedulerException {
        SchedulerFactory answer;

        Properties prop = loadProperties();
        if (prop != null) {

            // force disabling update checker (will do online check over the internet)
View Full Code Here

        }
        return answer;
    }

    protected SchedulerFactory createSchedulerFactory() throws SchedulerException {
        SchedulerFactory answer;

        Properties prop = loadProperties();
        if (prop != null) {

            // force disabling update checker (will do online check over the internet)
View Full Code Here

        if (this.scheduler != null)
        {
            throw new UnsupportedOperationException("the scheduler is started already");
        }

        SchedulerFactory schedulerFactory = null;
        try
        {
            Properties properties = new Properties();
            properties.put(StdSchedulerFactory.PROP_SCHED_JOB_FACTORY_CLASS, CdiAwareJobFactory.class.getName());

            try
            {
                ResourceBundle config = loadCustomQuartzConfig();

                Enumeration<String> keys = config.getKeys();
                String key;
                while (keys.hasMoreElements())
                {
                    key = keys.nextElement();
                    properties.put(key, config.getString(key));
                }
            }
            catch (Exception e1)
            {
                LOG.info("no custom quartz-config file found. falling back to the default config provided by quartz.");

                InputStream inputStream = null;
                try
                {
                    inputStream = ClassUtils.getClassLoader(null).getResourceAsStream("org/quartz/quartz.properties");
                    properties.load(inputStream);
                }
                catch (Exception e2)
                {
                    LOG.warning("failed to load quartz default-config");
                    schedulerFactory = new StdSchedulerFactory();
                }
                finally
                {
                    if (inputStream != null)
                    {
                        inputStream.close();
                    }
                }
            }
            if (schedulerFactory == null)
            {
                schedulerFactory = new StdSchedulerFactory(properties);
            }
        }
        catch (Exception e)
        {
            LOG.log(Level.WARNING, "fallback to default scheduler-factory", e);
            schedulerFactory = new StdSchedulerFactory();
        }

        try
        {
            this.scheduler = schedulerFactory.getScheduler();
            this.scheduler.getListenerManager().addJobListener(new InjectionAwareJobListener());

            if (!this.scheduler.isStarted())
            {
                String delayedStart =
View Full Code Here

TOP

Related Classes of org.quartz.SchedulerFactory

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.