Examples of DelayedExecutionUnit


Examples of com.aicontest.visualizer.js.tasks.DelayedExecutionUnit

  public boolean offer(IExecutionUnit eu) {
    final ReentrantLock lock = this.lock;
    lock.lock();
    try {
      if (eu instanceof DelayedExecutionUnit) {
        DelayedExecutionUnit deu = (DelayedExecutionUnit) eu;
        DelayedExecutionUnit first = delayed.peek();
        delayed.offer(deu);
        if (first == null || deu.compareTo(first) < 0)
          available.signalAll();
      } else {
        immediate.offer((EventExecutionUnit) eu);
View Full Code Here

Examples of com.aicontest.visualizer.js.tasks.DelayedExecutionUnit

    final ReentrantLock lock = this.lock;
    lock.lock();
    try {
      IExecutionUnit eu = immediate.peek();
      if (eu == null) {
        DelayedExecutionUnit deu = delayed.peek();
        if (deu == null || deu.getDelay(TimeUnit.NANOSECONDS) > 0) {
          return null;
        } else {
          IExecutionUnit x = delayed.poll();
          assert x != null;
          if (delayed.size() != 0)
View Full Code Here

Examples of com.aicontest.visualizer.js.tasks.DelayedExecutionUnit

          assert x != null;
          if (immediate.size() != 0)
            available.signalAll();
          return x;
        }
        DelayedExecutionUnit deu = delayed.peek();
        if (deu != null) {
          long delay = deu.getDelay(TimeUnit.NANOSECONDS);
          if (delay > 0) {
            available.awaitNanos(delay);
          } else {
            IExecutionUnit x = delayed.poll();
            assert x != null;
View Full Code Here

Examples of com.aicontest.visualizer.js.tasks.DelayedExecutionUnit

          assert x != null;
          if (immediate.size() != 0)
            available.signalAll();
          return x;
        }
        DelayedExecutionUnit deu = delayed.peek();
        if (deu == null) {
          if (nanos <= 0)
            return null;
          else
            nanos = available.awaitNanos(nanos);
        } else {
          long delay = deu.getDelay(TimeUnit.NANOSECONDS);
          if (delay > 0) {
            if (nanos <= 0)
              return null;
            if (delay > nanos)
              delay = nanos;
View Full Code Here

Examples of com.aicontest.visualizer.js.tasks.DelayedExecutionUnit

      c.addAll(immediate);
      int n = immediate.size();
      immediate.clear();
      int i = n;
      for (;;) {
        DelayedExecutionUnit first = delayed.peek();
        if (first == null || first.getDelay(TimeUnit.NANOSECONDS) > 0)
          break;
        c.add(delayed.poll());
        ++n;
      }
      if (n > i)
View Full Code Here

Examples of com.aicontest.visualizer.js.tasks.DelayedExecutionUnit

        c.addAll(immediate);
        n = immediate.size();
        immediate.clear();
        int i = n;
        while (n < maxElements) {
          DelayedExecutionUnit first = delayed.peek();
          if (first == null
              || first.getDelay(TimeUnit.NANOSECONDS) > 0)
            break;
          c.add(delayed.poll());
          ++n;
        }
        if (n > i)
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.