Class ExecutorManager<O extends ExecutorRunnable>

java.lang.Object
java.lang.Thread
ecmwf.common.technical.ExecutorManager<O>
Type Parameters:
O - the generic type
All Implemented Interfaces:
Runnable

public final class ExecutorManager<O extends ExecutorRunnable> extends Thread
The Class ExecutorManager.
  • Constructor Details

    • ExecutorManager

      public ExecutorManager(int maxWaiting, int maxRunning)
      Instantiates a new executor manager.
      Parameters:
      maxWaiting - the max waiting
      maxRunning - the max running
    • ExecutorManager

      public ExecutorManager(int maxWaiting, int maxRunning, boolean start)
      Instantiates a new executor manager.
      Parameters:
      maxWaiting - the max waiting
      maxRunning - the max running
      start - the start
  • Method Details

    • getThreadCount

      public AtomicInteger getThreadCount()
      Gets the thread count.
      Returns:
      the thread count
    • getCount

      public int getCount()
      Gets the count.
      Returns:
      the count
    • put

      public void put(O entry) throws InterruptedException
      Add a new Thread to the list. Inserts the Thread at the tail of this queue, waiting for space to become available if the queue is full.
      Parameters:
      entry - the entry
      Throws:
      InterruptedException - the interrupted exception
    • offer

      public boolean offer(O entry)
      Inserts the Thread at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, return false if this queue is full. If the Thread already exists in the queue then return true and do nothing.
      Parameters:
      entry - the entry
      Returns:
      true, if successful
    • startIfNotStarted

      public void startIfNotStarted()
      Start the Thread if it is not yet started.
    • stopRun

      public void stopRun()
      Ends the loop.
    • run

      public void run()
      Run.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • stopAndJoin

      public void stopAndJoin() throws InterruptedException
      Stop and join.
      Throws:
      InterruptedException - the interrupted exception