Examples of PeriodicTrigger


Examples of org.springframework.scheduling.support.PeriodicTrigger

   * @param duration the duration
   */
  public PollingTaskSupport(TaskScheduler taskScheduler, TaskExecutor taskExecutor, TimeUnit unit, long duration) {
    this.taskScheduler = taskScheduler;
    this.taskExecutor = taskExecutor;
    this.trigger = new PeriodicTrigger(unit.toMillis(duration));
  }
View Full Code Here

Examples of org.springframework.scheduling.support.PeriodicTrigger

   * @param duration the duration
   */
  public PollingTaskSupport(TaskScheduler taskScheduler, TaskExecutor taskExecutor, TimeUnit unit, long duration) {
    this.taskScheduler = taskScheduler;
    this.taskExecutor = taskExecutor;
    this.trigger = new PeriodicTrigger(unit.toMillis(duration));
  }
View Full Code Here

Examples of org.springframework.scheduling.support.PeriodicTrigger

                    "session validation interval of [" + sessionValidationInterval + "]ms...");
        }

        try {

            PeriodicTrigger trigger = new PeriodicTrigger(sessionValidationInterval, TimeUnit.MILLISECONDS);
            trigger.setInitialDelay(sessionValidationInterval);

            scheduler.schedule(new Runnable() {
                @Override
                public void run() {
                    if(enabled) {
View Full Code Here

Examples of org.springframework.scheduling.support.PeriodicTrigger

    synchronized (this.initializationMonitor) {
      if (this.initialized) {
        return;
      }
      if (this.trigger == null) {
        this.trigger = new PeriodicTrigger(100L);
      }
      if (taskScheduler == null && beanFactory != null) {
        taskScheduler = beanFactory.getBean(TASK_SCHEDULER_BEAN_NAME, TaskScheduler.class);
      }
    }
View Full Code Here

Examples of org.springframework.scheduling.support.PeriodicTrigger

    context.registerSingleton(IntegrationUtils.INTEGRATION_MESSAGE_BUILDER_FACTORY_BEAN_NAME,
        DefaultMessageBuilderFactory.class);
    context.refresh();

    PollerMetadata poller = new PollerMetadata();
    poller.setTrigger(new PeriodicTrigger(1000));
    bus.setPoller(poller);
  }
View Full Code Here

Examples of org.springframework.scheduling.support.PeriodicTrigger

    }

    if (triggerExpression != null && trigger == null) {
      if (triggerExpression.startsWith("fixed-delay:")) {
        long delay = Long.parseLong(triggerExpression.split(":")[1]);
        PeriodicTrigger periodicTrigger = new PeriodicTrigger(delay);
        periodicTrigger.setFixedRate(false);
        trigger = periodicTrigger;
      }
    }

    if (triggerExpression != null && trigger == null) {
      if (triggerExpression.startsWith("fixed-rate:")) {
        long delay = Long.parseLong(triggerExpression.split(":")[1]);
        PeriodicTrigger periodicTrigger = new PeriodicTrigger(delay);
        periodicTrigger.setFixedRate(true);
        trigger = periodicTrigger;
      }
    }

    if (triggerExpression != null && trigger == null) {
      if ("never".equals(triggerExpression)) {
        trigger = new NeverTrigger();
      }
    }

    if (triggerExpression != null && trigger == null) {
      if ("once".equals(triggerExpression)) {
        trigger = new OnceTrigger();
      }
    }

    if (triggerExpression != null && trigger == null) {

      if (triggerExpression.startsWith("once-after:")) {
        long delay = Long.parseLong(triggerExpression.split(":")[1]);
        OnceTrigger onceTrigger = new OnceTrigger();
        onceTrigger.setAfter(delay);
        trigger = onceTrigger;
      }

    }

    if (triggerExpression != null && trigger == null) {

      try {

        if (triggerExpression.startsWith("every:")) {
          String[] tokens = triggerExpression.split(":");

          long delay = Long.parseLong(tokens[1].substring(0, tokens[1].length() - 3));
          String unit = tokens[1].substring(tokens[1].length() - 3);

          Integer mult = null;
          switch (unit) {
          case "sec":
            mult = 1000;
            break;
          case "min":
            mult = 60 * 1000;
            break;

          default:
            // not supported time
          }

          if (mult != null) {
            PeriodicTrigger pt = new PeriodicTrigger(delay * mult);
            pt.setFixedRate(true);
            trigger = pt;
          }
        }

      } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.