Class OrderedTaskQueue

java.lang.Object
java.lang.Thread
org.cip4.jdflib.util.thread.OrderedTaskQueue
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
MultiTaskQueue

public class OrderedTaskQueue extends Thread
class to run heavy tasks one at a time
  • Method Details

    • getCreateQueue

      public static OrderedTaskQueue getCreateQueue(String name)
      grab the queue
      Parameters:
      name - - must not be null
      Returns:
      the queue to fill with tasks
    • shutDown

      public static void shutDown(String name)
      grab the queue
      Parameters:
      name - - must not be null
    • shutDownAll

      public static void shutDownAll()
    • shutDown

      public void shutDown()
    • interruptCurrent

      public boolean interruptCurrent(int minAge)
      Parameters:
      minAge - minimum age to interrupt
      Returns:
      true if we successfully interrupted or no entry was running; false if unsuccessful or current is younger than minAge
    • size

      public int size()
      size of the waiting queue
      Returns:
    • executing

      public int executing()
    • waiting

      public int waiting()
      size of the waiting queue + currently executing
      Returns:
    • getDone

      public int getDone()
      number of already completed tasks
      Returns:
    • isLive

      public boolean isLive()
      Returns:
    • queue

      public boolean queue(Runnable task)
      Parameters:
      task - the thing to send off
      Returns:
      true if successfully queued
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Thread
      Returns:
      See Also:
    • shortString

      public String shortString()
    • getAvQueue

      public long getAvQueue()
      Getter for average time waiting
      Returns:
      the average sumQueue
    • getSumQueue

      public long getSumQueue()
      Getter for sumQueue attribute. total time waiting
      Returns:
      the sumQueue
    • getAvRun

      public long getAvRun()
      Getter for average time running
      Returns:
      the average sumRun
    • getSumRun

      public long getSumRun()
      Getter for sumRun attribute. total time running
      Returns:
      the sumRun