Package org.springframework.scheduling.support

Examples of org.springframework.scheduling.support.CronTrigger


            {
                log.info( "schedule download remote index for repository {} with cron expression {}",
                          remoteRepository.getId(), remoteRepository.getCronExpression() );
                try
                {
                    CronTrigger cronTrigger = new CronTrigger( remoteRepository.getCronExpression() );
                    taskScheduler.schedule(
                        new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
                        cronTrigger );
                }
                catch ( IllegalArgumentException e )
View Full Code Here


            {
                log.info( "schedule download remote index for repository {} with cron expression {}",
                          remoteRepository.getId( ), remoteRepository.getCronExpression( ) );
                taskScheduler.schedule(
                    new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
                    new CronTrigger( remoteRepository.getCronExpression( ) ) );
            }

        }
        catch ( RepositoryAdminException e )
        {
View Full Code Here

            {
                log.info( "schedule download remote index for repository {} with cron expression {}",
                          remoteRepository.getId(), remoteRepository.getCronExpression() );
                try
                {
                    CronTrigger cronTrigger = new CronTrigger( remoteRepository.getCronExpression() );
                    taskScheduler.schedule(
                        new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
                        cronTrigger );
                }
                catch ( IllegalArgumentException e )
View Full Code Here

            if(td == null || (forceStart == false && Boolean.TRUE.equals(td.getStart()))) {
                return;
            }

            try {
                ScheduledFuture<?> future = taskScheduler.schedule(createTask(td), new CronTrigger(td.getCron()));
                taskMap.put(taskDefinitionId, future);
                td.setStart(Boolean.TRUE);
            } catch (Exception e) {
                logger.error("start task error, task id:" + taskDefinitionId, e);
                td.setDescription(e.getMessage());
View Full Code Here

   * Create a new {@code CronTask}.
   * @param runnable the underlying task to execute
   * @param expression cron expression defining when the task should be executed
   */
  public CronTask(Runnable runnable, String expression) {
    this(runnable, new CronTrigger(expression));
  }
View Full Code Here

          timeZone = StringUtils.parseTimeZoneString(zone);
        }
        else {
          timeZone = TimeZone.getDefault();
        }
        this.registrar.addCronTask(new CronTask(runnable, new CronTrigger(cron, timeZone)));
      }

      // At this point we don't need to differentiate between initial delay set or not anymore
      if (initialDelay < 0) {
        initialDelay = 0;
View Full Code Here

    assertEquals("cron", targetMethod.getName());
    assertEquals("0 0 0-4,6-23 * * ?", task.getExpression());
    Trigger trigger = task.getTrigger();
    assertNotNull(trigger);
    assertTrue(trigger instanceof CronTrigger);
    CronTrigger cronTrigger = (CronTrigger) trigger;
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+10"));
    cal.clear();
    cal.set(2013, 3, 15, 4, 0); // 15-04-2013 4:00 GMT+10
    Date lastScheduledExecutionTime = cal.getTime();
    Date lastActualExecutionTime = cal.getTime();
    cal.add(Calendar.MINUTE, 30); // 4:30
    Date lastCompletionTime = cal.getTime();
    TriggerContext triggerContext = new SimpleTriggerContext(
        lastScheduledExecutionTime, lastActualExecutionTime, lastCompletionTime);
    cal.add(Calendar.MINUTE, 30);
    cal.add(Calendar.HOUR_OF_DAY, 1); // 6:00
    Date nextExecutionTime = cronTrigger.nextExecutionTime(triggerContext);
    assertEquals(cal.getTime(), nextExecutionTime); // assert that 6:00 is next execution time
    Thread.sleep(10000);
  }
View Full Code Here

        this.scheduledFutures.add(this.taskScheduler.schedule(entry.getKey(), entry.getValue()));
      }
    }
    if (this.cronTasks != null) {
      for (Map.Entry<Runnable, String> entry : cronTasks.entrySet()) {
        this.scheduledFutures.add(this.taskScheduler.schedule(entry.getKey(), new CronTrigger(entry.getValue())));
      }
    }
    if (this.fixedRateTasks != null) {
      for (Map.Entry<Runnable, Long> entry : this.fixedRateTasks.entrySet()) {
        this.scheduledFutures.add(this.taskScheduler.scheduleAtFixedRate(entry.getKey(), entry.getValue()));
View Full Code Here

            {
                log.info( "schedule download remote index for repository {} with cron expression {}",
                          remoteRepository.getId(), remoteRepository.getCronExpression() );
                try
                {
                    CronTrigger cronTrigger = new CronTrigger( remoteRepository.getCronExpression() );
                    taskScheduler.schedule(
                        new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
                        cronTrigger );
                }
                catch ( IllegalArgumentException e )
View Full Code Here

        this.scheduledFutures.add(this.taskScheduler.schedule(entry.getKey(), entry.getValue()));
      }
    }
    if (this.cronTasks != null) {
      for (Map.Entry<Runnable, String> entry : this.cronTasks.entrySet()) {
        this.scheduledFutures.add(this.taskScheduler.schedule(entry.getKey(), new CronTrigger(entry.getValue())));
      }
    }
    if (this.fixedRateTasks != null) {
      for (Map.Entry<Runnable, Long> entry : this.fixedRateTasks.entrySet()) {
        this.scheduledFutures.add(this.taskScheduler.scheduleAtFixedRate(entry.getKey(), entry.getValue()));
View Full Code Here

TOP

Related Classes of org.springframework.scheduling.support.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.