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
The Class ExecutorManager.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionExecutorManager
(int maxWaiting, int maxRunning) Instantiates a new executor manager.ExecutorManager
(int maxWaiting, int maxRunning, boolean start) Instantiates a new executor manager. -
Method Summary
Modifier and TypeMethodDescriptionint
getCount()
Gets the count.Gets the thread count.boolean
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.void
Add a new Thread to the list.void
run()
Run.void
Start the Thread if it is not yet started.void
Stop and join.void
stopRun()
Ends the loop.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Constructor Details
-
ExecutorManager
public ExecutorManager(int maxWaiting, int maxRunning) Instantiates a new executor manager.- Parameters:
maxWaiting
- the max waitingmaxRunning
- the max running
-
ExecutorManager
public ExecutorManager(int maxWaiting, int maxRunning, boolean start) Instantiates a new executor manager.- Parameters:
maxWaiting
- the max waitingmaxRunning
- the max runningstart
- the start
-
-
Method Details
-
getThreadCount
-
getCount
public int getCount()Gets the count.- Returns:
- the count
-
put
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
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
-
stopAndJoin
Stop and join.- Throws:
InterruptedException
- the interrupted exception
-