Package gov.nih.mipav.model.structures
Class TimeoutThread
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.structures.TimeoutThread
-
- All Implemented Interfaces:
java.lang.Runnable
public class TimeoutThread extends java.lang.Thread
Thread which sleeps for a pre-determined amount of time, then calls a method (if the thread hasn't had its shutdown method called). This class differs from ReminderThread because it sleeps before invoking the subscriber's callback method and because it will only invoke each subscriber's callback method once.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
isRunning
DOCUMENT ME!private long
sleeptime
DOCUMENT ME!protected java.util.Hashtable<java.lang.Object,java.lang.reflect.Method>
subscribersHashtable
DOCUMENT ME!
-
Constructor Summary
Constructors Constructor Description TimeoutThread(long sleeptime)
Creates a new ReminderThread object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubscriber(java.lang.Object object, java.lang.reflect.Method method)
DOCUMENT ME!void
removeSubscriber(java.lang.Object object)
DOCUMENT ME!void
run()
DOCUMENT ME!void
shutdown()
DOCUMENT ME!-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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
-
-
-
-
Method Detail
-
addSubscriber
public void addSubscriber(java.lang.Object object, java.lang.reflect.Method method)
DOCUMENT ME!- Parameters:
object
- DOCUMENT ME!method
- DOCUMENT ME!
-
removeSubscriber
public void removeSubscriber(java.lang.Object object)
DOCUMENT ME!- Parameters:
object
- DOCUMENT ME!
-
run
public void run()
DOCUMENT ME!- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
shutdown
public void shutdown()
DOCUMENT ME!
-
-