Package org.quartz

Examples of org.quartz.CronTrigger


      {
         JobDetail jobDetail = new JobDetail(quartzSpec.getJobName(), quartzSpec.getJobGroup(), clazz, true, false, false);
         jobDetail.getJobDataMap().setAllowsTransientData(true);
         jobDetail.getJobDataMap().put("endpointFactory", endpointFactory);
         log.debug("adding job: " + quartzSpec);
         CronTrigger trigger = new CronTrigger(quartzSpec.getTriggerName(), quartzSpec.getTriggerGroup(), quartzSpec.getCronTrigger());
         sched.scheduleJob(jobDetail, trigger);
      }
      catch (Exception e)
      {
         log.error(e);
View Full Code Here


    // Add job to read from the string writer every second
    try {
      jobName = "Log_Displayer_Job_" + this.hashCode();
      jobDetail = new JobDetail(jobName, LOG_DISPLAYER_GROUP, NoOpJob.class);
      jobDetail.addJobListener(jobName);
      CronTrigger trigger = new CronTrigger();
      trigger.setName(jobName);
      trigger.setGroup(LOG_DISPLAYER_GROUP);
      trigger.setCronExpression("* * * * * ?");
      // Schedule job now
      Scheduler scheduler = (Scheduler) CoreSpringFactory.getBean("schedulerFactoryBean");
      scheduler.addJobListener(this);
      scheduler.scheduleJob(jobDetail, trigger);
    } catch (ParseException e) {
View Full Code Here

    Scheduler scheduler = (Scheduler) CoreSpringFactory.getBean("schedulerFactoryBean");
    String cronExpression = "ERROR";
    try {
      // Create job with cron trigger configuration
      JobDetail jobDetail = new JobDetail(SCHEDULER_NAME, Scheduler.DEFAULT_GROUP, SystemRegistrationJob.class);
      CronTrigger trigger = new CronTrigger();
      trigger.setName("system_registration_trigger");
      cronExpression = persitedProperties.getStringPropertyValue(CONF_KEY_REGISTRATION_CRON, true);
      if (!CronExpression.isValidExpression(cronExpression)) {
        cronExpression = createCronTriggerExpression();
        persitedProperties.setStringPropertyDefault(CONF_KEY_REGISTRATION_CRON, cronExpression);
      }
      // Use this cron expression for debugging, tries to send data every minute
      //trigger.setCronExpression("0 * * * * ?");
      trigger.setCronExpression(cronExpression);
      // Schedule job now
      scheduler.scheduleJob(jobDetail, trigger);
    } catch (ParseException e) {

      logError("Illegal cron expression for scheduling translation status generator", e);
View Full Code Here

    // Use scheduler from spring config
    Scheduler scheduler = (Scheduler) CoreSpringFactory.getBean("schedulerFactoryBean");
    try {
      // Create job with cron trigger configuration
      JobDetail jobDetail = new JobDetail("LDAP_Cron_Syncer_Job", Scheduler.DEFAULT_GROUP, LDAPUserSynchronizerJob.class);
      CronTrigger trigger = new CronTrigger();
      trigger.setName("LDAP_Cron_Syncer_Trigger");
      trigger.setCronExpression(ldapSyncCronSyncExpression);
      // Schedule job now
      scheduler.scheduleJob(jobDetail, trigger);
      log.info("LDAP cron syncer is enabled with expression::" + ldapSyncCronSyncExpression);
    } catch (ParseException e) {
      setLdapSyncCronSync(false);
View Full Code Here

                trigger = TriggerUtils.makeImmediateTrigger(SimpleTrigger.REPEAT_INDEFINITELY,
                        repeatInterval);
            }

        } else {
            CronTrigger cronTrigger = new CronTrigger();
            try {
                cronTrigger.setCronExpression(cron);
                trigger = cronTrigger;
            } catch (ParseException e) {
                throw new SynapseTaskException("Error setting cron expression : " +
                        e.getMessage() + cron, log);
            }
View Full Code Here

      jobDetail.getJobDataMap().put("async", async);

      if (schedule instanceof CronSchedule)
      {
          CronSchedule cronSchedule = (CronSchedule) schedule;
          CronTrigger trigger = new CronTrigger (triggerName, null);
          trigger.setCronExpression(cronSchedule.getCron());
          trigger.setEndTime(cronSchedule.getFinalExpiration());
       
          if ( cronSchedule.getExpiration()!=null )
          {
            trigger.setStartTime (cronSchedule.getExpiration());
          }
          else if ( cronSchedule.getDuration()!=null )
          {
            trigger.setStartTime (calculateDelayedDate(cronSchedule.getDuration()));
          }
       
          scheduler.scheduleJob( jobDetail, trigger );
      }
      else if (schedule instanceof TimerSchedule)
View Full Code Here

    @Override
    public void startIndex() {
        try {
            JobDetail job = newJob(com.google.code.ftspc.lector.indexers.Lucene.LuceneTimerForFilesChecking.class).
                    withIdentity("jobForIndexer", "Lector").build();
            CronTrigger trigger = newTrigger().
                    withIdentity("triggerForIndexer", "Lector").
                    withSchedule(cronSchedule(Vars.CronExpressionForIndexer)).build();

            Date ft = Vars.sched.scheduleJob(job, trigger);
            System.out.println(job.getKey() + " has been scheduled to run at: " + ft
                    + " and repeat based on expression: "
                    + trigger.getCronExpression());
        } catch (Exception ex) {
            Vars.logger.warn(ex.getMessage(), ex);
        }
    }
View Full Code Here

        assertEquals("getGroup()", "Camel", trigger.getGroup());
    }

    public void testConfigureCronExpression() throws Exception {
        QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz://myGroup/myTimerName/0/0/12/*/*/$");
        CronTrigger trigger = assertIsInstanceOf(CronTrigger.class, endpoint.getTrigger());
        assertEquals("getName()", "myTimerName", trigger.getName());
        assertEquals("getGroup()", "myGroup", trigger.getGroup());
        assertEquals("cron expression", "0 0 12 * * ?", trigger.getCronExpression());
    }
View Full Code Here

        return answer;
    }

    protected CronTrigger createCronTrigger(String path) throws ParseException {
        CronTrigger cron = new CronTrigger();
        cron.setCronExpression(path);
        return cron;
    }
View Full Code Here

        incrementJobCounter(getScheduler());
    }

    private boolean hasTriggerChanged(Trigger oldTrigger, Trigger newTrigger) {
        if (oldTrigger instanceof CronTrigger && oldTrigger.equals(newTrigger)) {
            CronTrigger oldCron = (CronTrigger) oldTrigger;
            CronTrigger newCron = (CronTrigger) newTrigger;
            return !oldCron.getCronExpression().equals(newCron.getCronExpression());
        } else {
            return !newTrigger.equals(oldTrigger);
        }
    }
View Full Code Here

TOP

Related Classes of org.quartz.CronTrigger

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.