Examples of TimedTask


Examples of org.jboss.errai.bus.server.async.TimedTask

    }
  }

  private long runAllDue() throws InterruptedException {
    long nextRunTime = 0;
    TimedTask task;

    while ((task = scheduledTasks.poll(60, java.util.concurrent.TimeUnit.SECONDS)) != null) {
      if (!task.isDue(currentTimeMillis())) {
        parkUntil(task.nextRuntime());
      }

      /**
       * Sechedule the task for execution.
       */
      if (!queue.offer(task, 5, java.util.concurrent.TimeUnit.SECONDS)) {
        saturationPolicy.dealWith(task);
      }

      if (task.calculateNextRuntime()) {
        scheduledTasks.offer(task);
      }
    }

    return nextRunTime;
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

   * processed
   */
  public void scheduleActivation() {
    synchronized (activationLock) {
      bus.getScheduler().addTask(
              task = new TimedTask() {
                {
                  period = -1; // only fire once.
                  nextRuntime = getEndOfWindow();
                }

View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

  public AsyncTask schedule(final Runnable runnable, TimeUnit unit, long interval) {
    checkLoad();
    mutex.lock();
    try {
      TimedTask task;
      scheduledTasks.offer(task = new DelayedTask(runnable, unit.toMillis(interval)));

      return task;
    }
    finally {
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

  public AsyncTask scheduleRepeating(final Runnable runnable, final TimeUnit unit, final long initial, final long interval) {
    checkLoad();
    mutex.lock();
    try {
      TimedTask task;
      scheduledTasks.offer(task = new RepeatingTimedTask(runnable, unit.toMillis(initial), unit.toMillis(interval)));

      return task;
    }
    finally {
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

    }
  }

  private long runAllDue() throws InterruptedException {
    long nextRunTime = 0;
    TimedTask task;

    while ((task = scheduledTasks.poll(60, java.util.concurrent.TimeUnit.SECONDS)) != null) {
      if (!task.isDue(currentTimeMillis())) {
        parkUntil(task.nextRuntime());
      }

      /**
       * Sechedule the task for execution.
       */
      if (!queue.offer(task, 5, java.util.concurrent.TimeUnit.SECONDS)) {
        saturationPolicy.dealWith(task);
      }

      if (task.calculateNextRuntime()) {
        scheduledTasks.offer(task);
      }
    }

    return nextRunTime;
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

  public AsyncTask schedule(final Runnable runnable, TimeUnit unit, long interval) {
    checkLoad();
    mutex.lock();
    try {
      TimedTask task;
      scheduledTasks.offer(task = new DelayedTask(runnable, unit.toMillis(interval)));

      return task;
    }
    finally {
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

  public AsyncTask scheduleRepeating(final Runnable runnable, final TimeUnit unit, final long initial, final long interval) {
    checkLoad();
    mutex.lock();
    try {
      TimedTask task;
      scheduledTasks.offer(task = new RepeatingTimedTask(runnable, unit.toMillis(initial), unit.toMillis(interval)));

      return task;
    }
    finally {
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

    }
  }

  private long runAllDue() throws InterruptedException {
    long nextRunTime = 0;
    TimedTask task;

    while ((task = scheduledTasks.poll(60, java.util.concurrent.TimeUnit.SECONDS)) != null) {
      if (!task.isDue(currentTimeMillis())) {
        parkUntil(task.nextRuntime());
      }

      /**
       * Sechedule the task for execution.
       */
      if (!queue.offer(task, 5, java.util.concurrent.TimeUnit.SECONDS)) {
        saturationPolicy.dealWith(task);
      }

      if (task.calculateNextRuntime()) {
        scheduledTasks.offer(task);
      }
    }

    return nextRunTime;
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

    return !thread.isAlive();
  }

  @Override
  public void run() {
    TimedTask task = null;
    while (active) {
      try {
        while (active) {
          if ((task = pool.getNextTask()) == null) {
            continue;
          }
          task.run();
        }
      }
      catch (InterruptedException e) {
        if (!active) {
          /**
           * If the thread has been marked inactive, terminate now.  Otherwise continue along
           * normally.
           */
          isStopped = true;
          return;
        }
      }
      catch (Throwable t) {
        if (task != null) {
          task.cancel(true);
        }

        if (errorCallback != null) {
          /**
           * If the errorCallback is defined for this ThreadWorker, we report the exception we
View Full Code Here

Examples of org.jboss.errai.bus.server.async.TimedTask

  public AsyncTask schedule(final Runnable runnable, TimeUnit unit, long interval) {
    checkLoad();
    mutex.lock();
    try {
      TimedTask task;
      scheduledTasks.offer(task = new DelayedTask(runnable, unit.toMillis(interval)));

      return task;
    }
    finally {
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.