public class TaskQueue extends Thread
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Modifier and Type | Method and Description |
|---|---|
void |
cancelTasks(Class taskClass) |
static void |
emptyAndRemoveQueue(String strQueueName)
Clears all the inactive tasks in the specified queue.
|
void |
emptyQueue()
Empty the queue
|
static TaskQueue |
getInstance(ILogger logger,
String strQueueName)
Fetch a TaskQueue by name.
|
static TaskQueue |
getInstance(String strQueueName)
Fetch a TaskQueue by name.
|
List<Runnable> |
getTasks()
Get a list of all the tasks in this TaskQueue.
|
static boolean |
hasWork() |
static void |
killAll()
Stops all task queues and dumps thier queue.
|
protected void |
log(Throwable t)
Log an exception or error.
|
Runnable |
peekTask()
Peek at the "current" task in the queue.
|
void |
postTask(Runnable task)
Posts a task to the queue (asynchronously).
|
void |
postTaskAndWait(Runnable runnable) |
void |
postTaskAndWait(Runnable runnable,
long timeout) |
void |
run()
Do NOT ever call this! Public only by contract.
|
void |
setILogger(ILogger logger) |
int |
size()
Get the size of the queue at the instance this is called.
|
void |
waitUntilAllCurrentTasksFinish() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic static TaskQueue getInstance(String strQueueName)
public static TaskQueue getInstance(ILogger logger, String strQueueName)
logger - An optional logger.strQueueName - The unique name for the queue.public static void emptyAndRemoveQueue(String strQueueName)
public static void killAll()
public void postTask(Runnable task)
task - A task to run in the TaskQueue's thread.public void waitUntilAllCurrentTasksFinish()
public Runnable peekTask()
public List<Runnable> getTasks()
public void emptyQueue()
public int size()
public void run()
protected void log(Throwable t)
public static boolean hasWork()
public void postTaskAndWait(Runnable runnable, long timeout)
public void postTaskAndWait(Runnable runnable)
public void cancelTasks(Class taskClass)
public void setILogger(ILogger logger)
Copyright © 2020. All rights reserved.