public abstract class PausableThread
extends java.lang.Thread
Modifier and Type | Class and Description |
---|---|
protected static class |
PausableThread.ThreadPriority
Specifies the scheduling priority of a
Thread . |
Constructor and Description |
---|
PausableThread() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterRun()
Called once at the end of the
run() method. |
void |
awaitPausing()
Causes the current thread to wait until this thread is pausing.
|
protected abstract void |
doWork()
Called when this thread is not paused and should do its work.
|
void |
finish() |
protected abstract PausableThread.ThreadPriority |
getThreadPriority() |
protected abstract boolean |
hasWork() |
void |
interrupt() |
boolean |
isPausing() |
void |
pause()
The thread should stop its work temporarily.
|
void |
proceed()
The paused thread should continue with its work.
|
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public final void awaitPausing()
public final void finish()
public void interrupt()
interrupt
in class java.lang.Thread
public final boolean isPausing()
public final void pause()
public final void proceed()
public final void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void afterRun()
run()
method. The default implementation is empty.protected abstract void doWork() throws java.lang.InterruptedException
java.lang.InterruptedException
- if the thread has been interrupted.protected abstract PausableThread.ThreadPriority getThreadPriority()
protected abstract boolean hasWork()