Type
- type of items queuedpublic abstract class QueueProcessingThread<Type> extends Thread
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Modifier | Constructor and Description |
---|---|
protected |
QueueProcessingThread(@NonNull String name)
Creates a thread and starts itself.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanup(@NonNull Queue<Type> remainingQueue)
This method is called after the thread has been interrupted.
|
boolean |
contains(Type item)
Gets if the queue contains a specified item.
|
@NonNull Queue<Type> |
getQueue()
Gets a copy of the queue in its current state.
|
protected abstract void |
processElement(Type element)
Processes an element from the queue.
|
void |
queue(Type item)
Queues an item.
|
void |
run() |
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, yield
protected QueueProcessingThread(@NonNull String name)
name
- name of the threadprotected void cleanup(@NonNull Queue<Type> remainingQueue)
remainingQueue
- the queueprotected abstract void processElement(Type element)
element
- next element from the queuepublic boolean contains(Type item)
item
- the itempublic @NonNull Queue<Type> getQueue()
public void queue(Type item)
item
- item to queueCopyright © 2013–2021 Kitteh. All rights reserved.