Package org.quartz

Examples of org.quartz.SchedulerFactory


    private Scheduler scheduler;

    @Before
    public void setUp() throws SchedulerException {
        eventBus = mock(EventBus.class);
        SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
        testSubject = new QuartzEventScheduler();
        scheduler = schedFact.getScheduler();
        scheduler.getContext().put(EventBus.class.getName(), eventBus);
        scheduler.start();
        testSubject.setScheduler(scheduler);
        testSubject.setEventBus(eventBus);
        testSubject.setGroupIdentifier(GROUP_ID);
View Full Code Here


        }
        return schedulerFactory;
    }

    private 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

    @Test
    public void testQuartzComponentCustomScheduler() throws Exception {
        QuartzComponent comp = new QuartzComponent();
        comp.setCamelContext(context);

        SchedulerFactory fac = new StdSchedulerFactory();
        comp.setSchedulerFactory(fac);
        assertSame(fac, comp.getSchedulerFactory());

        Scheduler sch = fac.getScheduler();
        comp.setScheduler(sch);
        assertSame(sch, comp.getScheduler());

        comp.start();
        comp.stop();
View Full Code Here

    @Test
    public void testQuartzComponentCustomScheduler() throws Exception {
        QuartzComponent comp = new QuartzComponent();
        comp.setCamelContext(context);

        SchedulerFactory fac = new StdSchedulerFactory();
        comp.setFactory(fac);
        assertSame(fac, comp.getFactory());

        Scheduler sch = fac.getScheduler();
        comp.setScheduler(sch);
        assertSame(sch, comp.getScheduler());

        comp.start();
        comp.stop();
View Full Code Here

    @Autowired
    DefaultConfigService defaultConfigService;

    public static Scheduler getScheduler() {
        if (scheduler == null) {
            SchedulerFactory schedulerFactory = new StdSchedulerFactory();

            try {
                scheduler = schedulerFactory.getScheduler();
            } catch (SchedulerException ex) {
                log.error("Error when trying to get a reference to a scheduler", ex);
            }
        }
        return scheduler;
View Full Code Here

    @Autowired
    DefaultConfigService defaultConfigService;

    public static Scheduler getScheduler() {
        if (scheduler == null) {
            SchedulerFactory schedulerFactory = new StdSchedulerFactory();
            try {
                scheduler = schedulerFactory.getScheduler();
            } catch (SchedulerException ex) {
                log.error("Error when trying to get a reference to a scheduler", ex);
            }
        }
        return 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

    private Scheduler sched2 = null;
    static Logger log = Logger.getLogger(QuartzInit.class);

    public void contextInitialized(ServletContextEvent event) {
        try {
            SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();

            sched = schedFact.getScheduler();

            sched.start();

            // define the job and tie it to our HelloJob class
            JobDetail job = newJob(HelloJob.class)
                    .withIdentity("myJob", "group1").withDescription("Some rand job").storeDurably(true)
                    .build();

            // Trigger the job to run now, and then every 40 seconds
            Trigger trigger = newTrigger()
                    .withIdentity("myTrigger", "group1")
                    .startNow()
                    .withSchedule(simpleSchedule()
                            .withIntervalInSeconds(120)
                            .repeatForever())
                    .build();

            // Tell quartz to schedule the job using our trigger
            sched.scheduleJob(job, trigger);
            log.info("Job Created: " + job);

            // Job #2
            // define the job and tie it to our HelloJob class
            job = newJob(HelloJob.class)
                    .withIdentity("myJob2", "group1").withDescription("Some rand job2").storeDurably(true)
                    .build();

            // Trigger the job to run now, and then every 40 seconds
            trigger = newTrigger()
                    .withIdentity("myTrigger2", "group1")
                    .startNow()
                    .withSchedule(simpleSchedule()
                            .withIntervalInMinutes(5)
                            .repeatForever())
                    .build();

            // Tell quartz to schedule the job using our trigger
            sched.scheduleJob(job, trigger);
            log.info("Job Created: " + job);

            // Group #2, Job #1
            // define the job and tie it to our HelloJob class
            job = newJob(HelloJob.class)
                    .withIdentity("myJob1", "group2").withDescription("Some rand job3").storeDurably(true)
                    .build();

            // Trigger the job to run now, and then every 40 seconds
            trigger = newTrigger()
                    .withIdentity("myTrigger3", "group2")
                    .startNow()
                    .withSchedule(simpleSchedule()
                            .withIntervalInMinutes(1)
                            .repeatForever())
                    .build();

            // Tell quartz to schedule the job using our trigger
            sched.scheduleJob(job, trigger);
            log.info("Job Created: " + job);

            // second scheduler
            // Tell Quartz to look out out for quartz2.properties
            System.setProperty(StdSchedulerFactory.PROPERTIES_FILE, "quartz2.properties");
            schedFact = new org.quartz.impl.StdSchedulerFactory();
            sched2 = schedFact.getScheduler();
            sched2.start();
            // define the job and tie it to our HelloJob class
            JobDetail jobx = newJob(HelloJob.class)
                    .withIdentity("myJobx", "groupx").withDescription("Some rand jobx").storeDurably(true)
                    .build();
            // Trigger the job to run now, and then every 40 seconds
            Trigger triggerx = newTrigger().forJob(jobx)
                    .withIdentity("myTriggerx", "groupx")
                    .startNow()
                    .withSchedule(simpleSchedule()
                            .withIntervalInSeconds(450)
                            .repeatForever())
                    .build();
            // Tell quartz to schedule the job using our trigger
            sched2.addJob(jobx, true);
            sched2.scheduleJob(triggerx);
            log.info("Job Created: " + jobx);
            Trigger triggerx2 = newTrigger().forJob(jobx)
                    .withIdentity("myTriggerx2", "groupx2")
                    .startNow()
                    .withSchedule(simpleSchedule()
                            .withIntervalInHours(1)
                            .repeatForever())
                    .build();
            // Tell quartz to schedule the job using our trigger
            sched2.scheduleJob(triggerx2);

            System.setProperty(StdSchedulerFactory.PROPERTIES_FILE, "quartz3.properties");
            schedFact = new org.quartz.impl.StdSchedulerFactory();
            sched3 = schedFact.getScheduler();
            sched3.start();
            int groups = 3;
            int jobspergroup = 3;
            for (int g = 0; g < groups; g++) {
                String group = "group" + g;
View Full Code Here

      props.load(is);

      // Perform property variable expansion
      Properties exandedProps = SettingUtil.expandProperties(props);

      SchedulerFactory quartzFactory = new StdSchedulerFactory(exandedProps);
      quartzInstance = quartzFactory.getScheduler();

      ScheduledProcessJobFactory jobFactory = new ScheduledProcessJobFactory(processServer);
      quartzInstance.setJobFactory(jobFactory);

      start();
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.