- All Implemented Interfaces:
- Direct Known Subclasses:
public abstract class AbstractAudioThread extends java.lang.Thread implements AudioThreadBase implementation of all common thread code for use by threads in the various Audio classes.
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Constructors Constructor Description
AbstractAudioThread()Default constructor that gives this thread a unique name based on the value of the static counter
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
alive()Checks if the thread is still alive (or in the process of shutting down)
cleanup()Perform necessary cleanup routines before shutting down.
die()Method used to tell the thread that it should shutdown
dying()Checks if the thread is 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
public AbstractAudioThread()Default constructor that gives this thread a unique name based on the value of the static counter
protected void cleanup()Perform necessary cleanup routines before shutting down.
public boolean alive()Description copied from interface:
AudioThreadChecks if the thread is still alive (or in the process of shutting down)
Once cleanup has finished, this should return False
public void die()Description copied from interface:
AudioThreadMethod used to tell the thread that it should shutdown
protected boolean dying()Checks if the thread is in the process of shutting down.
- true, if thread should die
protected static void snooze(long ms)Sleep for the specified number of milliseconds.
(Avoids cluttering the main code with the try-catch construct)
ms- number of milliseconds to sleep for