Package com.logicaldoc.core.threading
Class NotifyingThread
- java.lang.Object
-
- java.lang.Thread
-
- com.logicaldoc.core.threading.NotifyingThread
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
NotifyingThread.ThreadCompleteListener
Interface to be implemented by the listeners-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description NotifyingThread()
NotifyingThread(Runnable target, String name)
NotifyingThread(String name)
NotifyingThread(ThreadGroup group, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(NotifyingThread.ThreadCompleteListener listener)
void
doRun()
Concrete implementations should override this method to implement their own processing.long
getElapsedTime()
Gets the elapsed time since the begin of the execution until now o until the end of the thread's executionThrowable
getError()
boolean
isOver()
Checks if the thread has finishedvoid
removeListener(NotifyingThread.ThreadCompleteListener listener)
void
run()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
NotifyingThread
public NotifyingThread()
-
NotifyingThread
public NotifyingThread(String name)
-
NotifyingThread
public NotifyingThread(ThreadGroup group, String name)
-
-
Method Detail
-
addListener
public final void addListener(NotifyingThread.ThreadCompleteListener listener)
-
removeListener
public final void removeListener(NotifyingThread.ThreadCompleteListener listener)
-
getElapsedTime
public long getElapsedTime()
Gets the elapsed time since the begin of the execution until now o until the end of the thread's execution- Returns:
- the elapsed time in milliseconds
-
isOver
public boolean isOver()
Checks if the thread has finished- Returns:
- if the it has finished
-
doRun
public void doRun() throws Throwable
Concrete implementations should override this method to implement their own processing.- Throws:
Throwable
- whatever error that happens during the elaboration
-
getError
public Throwable getError()
-
-