Package org.cip4.jdflib.util.thread
Class MultiTaskQueue
java.lang.Object
java.lang.Thread
org.cip4.jdflib.util.thread.OrderedTaskQueue
org.cip4.jdflib.util.thread.MultiTaskQueue
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
MultiJobTaskQueue
class to run heavy tasks one at a time
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Method Summary
Modifier and TypeMethodDescriptionintstatic MultiTaskQueuegetCreateQueue(String name, int maxParallel) grab the queueintget the number of currently running tasksintstatic intbooleaninterruptCurrent(int minAge) booleaninterruptTask(Runnable theRunner) voidsetMaxParallel(int maxParallel) static voidsetPercentQueue(int percentQueue) voidshutDown()voidstart()toString()Methods inherited from class org.cip4.jdflib.util.thread.OrderedTaskQueue
getAvQueue, getAvRun, getCreateQueue, getDone, getSumQueue, getSumRun, isLive, queue, run, shortString, shutDown, shutDownAll, size, waitingMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, yield
-
Method Details
-
getPercentQueue
public static int getPercentQueue() -
setPercentQueue
public static void setPercentQueue(int percentQueue) -
getCreateQueue
grab the queue- Parameters:
name- - must not be nullmaxParallel- ignored if <=0- Returns:
- the queue to fill with tasks
-
setMaxParallel
public void setMaxParallel(int maxParallel) - Parameters:
maxParallel-
-
getCurrentRunning
public int getCurrentRunning()get the number of currently running tasks- Returns:
-
interruptCurrent
public boolean interruptCurrent(int minAge) - Overrides:
interruptCurrentin classOrderedTaskQueue- Parameters:
minAge- minimum age to interrupt- Returns:
- true if we successfully interrupted or no entries were running
-
interruptTask
- Parameters:
theRunner- runner to zapp- Returns:
- true if we successfully interrupted or no entries were running
-
start
public void start() -
toString
- Overrides:
toStringin classOrderedTaskQueue- Returns:
- See Also:
-
getMaxParallel
public int getMaxParallel()- Returns:
- the maxParallel
-
shutDown
public void shutDown()- Overrides:
shutDownin classOrderedTaskQueue- See Also:
-
executing
public int executing()- Overrides:
executingin classOrderedTaskQueue- See Also:
-