Class AbstractAudioThread

    • Nested Class Summary

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

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractAudioThread()
      Default constructor that gives this thread a unique name based on the value of the static counter
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void cleanup()
      Perform necessary cleanup routines before shutting down.
      void die()
      Method used to tell the thread that it should shutdown
      protected boolean dying()
      Checks if the thread is in the process of shutting down.
      boolean isThreadAlive()
      Checks if the thread is still alive (or in the process of shutting down)
      protected static void snooze​(long ms)
      Sleep for the specified number of milliseconds.
      • 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, run, 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
      • Methods inherited from interface java.lang.Runnable

        run
    • Constructor Detail

      • AbstractAudioThread

        public AbstractAudioThread()
        Default constructor that gives this thread a unique name based on the value of the static counter
    • Method Detail

      • cleanup

        protected void cleanup()
        Perform necessary cleanup routines before shutting down.
      • isThreadAlive

        public boolean isThreadAlive()
        Description copied from interface: AudioThread
        Checks if the thread is still alive (or in the process of shutting down)

        Once cleanup has finished, this should return False

        Specified by:
        isThreadAlive in interface AudioThread
        Returns:
        true, while thread is alive; false, when all cleanup has finished
      • die

        public void die()
        Description copied from interface: AudioThread
        Method used to tell the thread that it should shutdown
        Specified by:
        die in interface AudioThread
      • dying

        protected boolean dying()
        Checks if the thread is in the process of shutting down.
        Returns:
        true, if thread should die
      • snooze

        protected static void snooze​(long ms)
        Sleep for the specified number of milliseconds.

        (Avoids cluttering the main code with the try-catch construct)

        Parameters:
        ms - number of milliseconds to sleep for