|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
core.background.BackgroundMonitor
public class BackgroundMonitor
The BackgroundMonitor class is used to start and stop a FolderWatcher instance. The class also sets listeners on the AllFiles object, and FolderWatcher instances through a Status interface to monitor progress and report it to the user.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
DEFAULT_SLEEP_TIME_HOURS
The default time to check the directory is 1 hours. |
static long |
DEFAULT_SLEEP_TIME_MILLISECS
The default time to check the directory is 1 hour. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
BackgroundMonitor()
Creates a new BackgroundMonitor object with the default time delay. |
|
BackgroundMonitor(int timeHoursDelay)
Creates a new BackgroundMonitor object. |
|
BackgroundMonitor(long timeDelay)
Creates a new BackgroundMonitor object with the given time delay in milliseconds. |
Method Summary | |
---|---|
void |
addBackgroundMonitorStatusListener(BackgroundMonitorStatusListener listener)
Adds a new BackgroundMonitorStatusListener object to the background monitor object. |
java.util.Date |
getNextRunTime()
Returns a Data object that details the next check for new tracks. |
int |
getTimeHoursDelay()
Returns the amount of time in hours between checks for changed folders. |
boolean |
isRunning()
Returns whether or not a new add tracks task will execute after the background monitor thread has finished sleeping. |
void |
removeBackgroundMonitorStatusListener(BackgroundMonitorStatusListener listener)
Removes the listener from the BackgroundMonitor object. |
void |
run()
|
void |
setStatus(Status status)
Sets the status object the background monitor object should report status information to. |
void |
setTimeDelay(long delay)
Sets the time delay to the given long value. |
void |
setTimeDelayHours(int hours)
Sets the time delay to the given time in hours. |
void |
startBackgroundMonitor(java.util.ArrayList<java.io.File> filesToMonitor,
int timeHoursDelay)
Starts a new Folder Watcher instance given the constructor variables. |
void |
stopBackgroundMonitor()
Stops the folder watcher instance if it is running. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_SLEEP_TIME_MILLISECS
public static final int DEFAULT_SLEEP_TIME_HOURS
Constructor Detail |
---|
public BackgroundMonitor()
public BackgroundMonitor(int timeHoursDelay)
timeHoursDelay
- The time in hours to delay execution of searching for new tracks.public BackgroundMonitor(long timeDelay)
timeDelay
- The amount of time between new track searches in milliseconds.Method Detail |
---|
public void setTimeDelay(long delay)
delay
- The amount of time between searches for new tracks in
milliseconds.public void setTimeDelayHours(int hours)
hours
- The amount of time between searches for new tracks in
hours.public void setStatus(Status status)
status
- The status object that the Background Monitor object
will report status updates too. If the status object has not
been initialized NullPointerExceptions will be thrown.public void stopBackgroundMonitor()
public void startBackgroundMonitor(java.util.ArrayList<java.io.File> filesToMonitor, int timeHoursDelay)
filesToMonitor
- The directories to monitor.timeHoursDelay
- The amount of time between checks for changed folders
in hours.public boolean isRunning()
public int getTimeHoursDelay()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.util.Date getNextRunTime()
public void addBackgroundMonitorStatusListener(BackgroundMonitorStatusListener listener)
listener
- The listener to add to the background monitor object.public void removeBackgroundMonitorStatusListener(BackgroundMonitorStatusListener listener)
listener
- The listener to remove from the BackgroundMonitor object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |