Examples of TimedTask


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

                  .noErrorHandling().sendGlobalWith(ServerMessageBusImpl.this);
        }
      }
    });

    houseKeeper.addTask(new TimedTask() {
      {
        this.period = (1000 * 10);
      }

      @SuppressWarnings({"UnusedParameters"})
View Full Code Here

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

      message.setFlag(RoutingFlags.RetryDelivery);
      if (!message.hasResource(RETRY_COUNT_KEY)) {
        message.setResource("retryAttempts", 0);
      }
      message.setResource("retryAttempts", message.getResource(Integer.class, RETRY_COUNT_KEY) + 1);
      getScheduler().addTaskConcurrently(new TimedTask() {
        {
          period = 250;
        }

        @Override
View Full Code Here

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

    if (svc.getBus() instanceof ServerMessageBusImpl) {
      ServerMessageBusImpl busImpl = (ServerMessageBusImpl) svc.getBus();
      /**
       * Add a housekeeper task to the bus housekeeper to timeout long-running tasks.
       */
      busImpl.getScheduler().addTask(new TimedTask() {
        {
          period = 1000;
        }

        public void run() {
View Full Code Here

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

  public boolean isAlive() {
    return !thread.isAlive();
  }

  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.
           */
          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

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)) {
        switch (saturationPolicy) {
          case CallerRuns:
            task.run();
            break;
          case Fail:
            throw new RuntimeException("could not schedule task: queue is saturated");
        }
      }

      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
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.