Package org.springframework.scheduling.concurrent

Examples of org.springframework.scheduling.concurrent.ConcurrentTaskScheduler


*/
public class PollingTaskSupportTests {

  @Test
  public void testPollingTask() throws InterruptedException {
    TaskScheduler taskScheduler = new ConcurrentTaskScheduler();
    TaskExecutor taskExecutor = new SyncTaskExecutor();
    TestPollingTaskSupport poller = new TestPollingTaskSupport(taskScheduler, taskExecutor,
        TimeUnit.SECONDS, 2);
    poller.init();
    poller.start();
View Full Code Here


    // if these tests starts to fail or cause other timing
    // problems, we need to find a better way to run
    // test without adding too long sleeps

    TaskScheduler taskScheduler = new ConcurrentTaskScheduler();
    TaskExecutor taskExecutor = new ConcurrentTaskExecutor();
    TestPollingTaskSupport poller = new TestPollingTaskSupport(taskScheduler, taskExecutor);
    IdleTimeoutTrigger trigger = new IdleTimeoutTrigger(1000);
    poller.setTrigger(trigger);
    poller.init();
View Full Code Here

    Assert.notNull(scheduler, "Scheduler object must not be null");
    if (scheduler instanceof TaskScheduler) {
      this.taskScheduler = (TaskScheduler) scheduler;
    }
    else if (scheduler instanceof ScheduledExecutorService) {
      this.taskScheduler = new ConcurrentTaskScheduler(((ScheduledExecutorService) scheduler));
    }
    else {
      throw new IllegalArgumentException("Unsupported scheduler type: " + scheduler.getClass());
    }
  }
View Full Code Here


  public void afterPropertiesSet() {
    if (this.taskScheduler == null) {
      this.localExecutor = Executors.newSingleThreadScheduledExecutor();
      this.taskScheduler = new ConcurrentTaskScheduler(this.localExecutor);
    }
    if (this.triggerTasks != null) {
      for (Map.Entry<Runnable, Trigger> entry : this.triggerTasks.entrySet()) {
        this.scheduledFutures.add(this.taskScheduler.schedule(entry.getKey(), entry.getValue()));
      }
View Full Code Here

    Assert.notNull(scheduler, "Scheduler object must not be null");
    if (scheduler instanceof TaskScheduler) {
      this.taskScheduler = (TaskScheduler) scheduler;
    }
    else if (scheduler instanceof ScheduledExecutorService) {
      this.taskScheduler = new ConcurrentTaskScheduler(((ScheduledExecutorService) scheduler));
    }
    else {
      throw new IllegalArgumentException("Unsupported scheduler type: " + scheduler.getClass());
    }
  }
View Full Code Here

  public void afterPropertiesSet() {
    long now = System.currentTimeMillis();

    if (this.taskScheduler == null) {
      this.localExecutor = Executors.newSingleThreadScheduledExecutor();
      this.taskScheduler = new ConcurrentTaskScheduler(this.localExecutor);
    }
    if (this.triggerTasks != null) {
      for (TriggerTask task : triggerTasks) {
        this.scheduledFutures.add(this.taskScheduler.schedule(
            task.getRunnable(), task.getTrigger()));
View Full Code Here

    Assert.notNull(scheduler, "Scheduler object must not be null");
    if (scheduler instanceof TaskScheduler) {
      this.taskScheduler = (TaskScheduler) scheduler;
    }
    else if (scheduler instanceof ScheduledExecutorService) {
      this.taskScheduler = new ConcurrentTaskScheduler(((ScheduledExecutorService) scheduler));
    }
    else {
      throw new IllegalArgumentException("Unsupported scheduler type: " + scheduler.getClass());
    }
  }
View Full Code Here

  protected void scheduleTasks() {
    long now = System.currentTimeMillis();

    if (this.taskScheduler == null) {
      this.localExecutor = Executors.newSingleThreadScheduledExecutor();
      this.taskScheduler = new ConcurrentTaskScheduler(this.localExecutor);
    }
    if (this.triggerTasks != null) {
      for (TriggerTask task : this.triggerTasks) {
        this.scheduledFutures.add(this.taskScheduler.schedule(
            task.getRunnable(), task.getTrigger()));
View Full Code Here

    Assert.notNull(scheduler, "Scheduler object must not be null");
    if (scheduler instanceof TaskScheduler) {
      this.taskScheduler = (TaskScheduler) scheduler;
    }
    else if (scheduler instanceof ScheduledExecutorService) {
      this.taskScheduler = new ConcurrentTaskScheduler(((ScheduledExecutorService) scheduler));
    }
    else {
      throw new IllegalArgumentException("Unsupported scheduler type: " + scheduler.getClass());
    }
  }
View Full Code Here

  }


  public void afterPropertiesSet() {
    if (this.taskScheduler == null) {
      this.taskScheduler = new ConcurrentTaskScheduler(Executors.newSingleThreadScheduledExecutor());
    }
    if (this.triggerTasks != null) {
      for (Map.Entry<Runnable, Trigger> entry : this.triggerTasks.entrySet()) {
        this.scheduledFutures.add(this.taskScheduler.schedule(entry.getKey(), entry.getValue()));
      }
View Full Code Here

TOP

Related Classes of org.springframework.scheduling.concurrent.ConcurrentTaskScheduler

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.