public class MustThread
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector<ThreadDoneListener> |
threadDoneListeners |
Constructor and Description |
---|
MustThread() |
MustThread(java.lang.Runnable target) |
MustThread(java.lang.Runnable target,
java.lang.String name) |
MustThread(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
addThreadDoneListener(ThreadDoneListener l)
Adds the specified ThreadDoneListener to receive thread done events.
|
protected void |
fireThreadDone() |
protected void |
fireThreadDone(java.lang.Exception exception) |
java.lang.String |
getEventMessage()
Returns the event message (error message).
|
protected int |
getFinalState()
Returns the final state of the thread.
|
protected void |
idle(int millies)
Let the thread sleep - use this method instead of Thread's sleep method
to let the application know that there are no real processes at the moment.
|
boolean |
isToRun()
Returns true if the thread is to be continued.
|
protected void |
logDebug(java.lang.String text)
Logs a message as a debug information.
|
protected void |
logError(java.lang.String text,
java.lang.Throwable throwable)
Logs a message as an error.
|
protected void |
logError(java.lang.Throwable throwable)
Logs a message as an error.
|
protected void |
logInfo(java.lang.String text)
Logs a message as information.
|
void |
setEventErrorMessage(java.lang.String eventMessage)
Sets the eventErrorMessage and indicate that the thread is not successful.
|
void |
setEventMessage(java.lang.String eventMessage)
Sets the eventMessage.
|
protected void |
setFinalState(int finalState)
Sets the final state of the thread.
|
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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected java.util.Vector<ThreadDoneListener> threadDoneListeners
public MustThread()
public MustThread(java.lang.String name)
public MustThread(java.lang.Runnable target)
public MustThread(java.lang.Runnable target, java.lang.String name)
public void addThreadDoneListener(ThreadDoneListener l)
ThreadDoneEvent
protected void fireThreadDone()
protected void fireThreadDone(java.lang.Exception exception)
public void setEventErrorMessage(java.lang.String eventMessage)
eventMessage
- The eventMessage to setprotected void setFinalState(int finalState)
finalState
- the final state of the threadThreadDoneEvent.FINAL_STATE_SUCCESSFUL
,
ThreadDoneEvent.FINAL_STATE_CANCELED
,
ThreadDoneEvent.FINAL_STATE_FAILED
protected int getFinalState()
ThreadDoneEvent.FINAL_STATE_SUCCESSFUL
,
ThreadDoneEvent.FINAL_STATE_CANCELED
,
ThreadDoneEvent.FINAL_STATE_FAILED
public void setEventMessage(java.lang.String eventMessage)
eventMessage
- The eventMessage to setpublic java.lang.String getEventMessage()
protected void logDebug(java.lang.String text)
text
- the message to logprotected void logInfo(java.lang.String text)
text
- the message to logprotected void logError(java.lang.Throwable throwable)
throwable
- the exception to logprotected void logError(java.lang.String text, java.lang.Throwable throwable)
text
- the message (text) to logthrowable
- the exception to logpublic boolean isToRun()
protected void idle(int millies)
millies
- the length of time to sleep in millisecondsCopyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de