|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.lti.utils.synchronization.CloseableThread
public abstract class CloseableThread
A base class for threads which need to be gracefully closed, since Thread.stop() is deprecated. Subclass should check isClosing() in their main loop in run(), and call setClosed() when run() completes.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected SynchronizedBoolean |
closing
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
CloseableThread()
|
|
CloseableThread(java.lang.String threadName)
|
|
CloseableThread(java.lang.ThreadGroup group,
java.lang.String threadName)
Deprecated. |
|
| Method Summary | |
|---|---|
void |
close()
|
boolean |
isClosed()
|
protected boolean |
isClosing()
intended to be checked by thread in its main loop. |
protected void |
setClosed()
to be called by the thread upon exit. |
protected void |
setClosing()
|
void |
waitUntilClosed()
|
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, 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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final SynchronizedBoolean closing
| Constructor Detail |
|---|
public CloseableThread()
public CloseableThread(java.lang.String threadName)
public CloseableThread(java.lang.ThreadGroup group,
java.lang.String threadName)
| Method Detail |
|---|
public void close()
protected void setClosing()
public boolean isClosed()
public void waitUntilClosed()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected boolean isClosing()
protected void setClosed()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||