Class 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.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • 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!
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • subscribersHashtable

        protected java.util.Hashtable<java.lang.Object,​java.lang.reflect.Method> subscribersHashtable
        DOCUMENT ME!
      • isRunning

        private volatile boolean isRunning
        DOCUMENT ME!
      • sleeptime

        private long sleeptime
        DOCUMENT ME!
    • Constructor Detail

      • TimeoutThread

        public TimeoutThread​(long sleeptime)
        Creates a new ReminderThread object.
        Parameters:
        sleeptime - DOCUMENT ME!
    • 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 interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • shutdown

        public void shutdown()
        DOCUMENT ME!