net.ontopia.utils
Class FileWatchdog
java.lang.Object
java.lang.Thread
net.ontopia.utils.FileWatchdog
- All Implemented Interfaces:
- Runnable
- Direct Known Subclasses:
- ActionConfigWatchdog
public abstract class FileWatchdog
- extends Thread
INTERNAL: Check every now and then that a certain file has not
changed. If it has, then call the doOnChange()
method.
- Since:
- 1.4
Field Summary |
static long |
DEFAULT_DELAY
The default delay between every file modification check, set to 6
seconds. |
protected long |
delay
The delay to observe between every check. |
protected String |
filename
The name of the file to observe for changes. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, 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 |
DEFAULT_DELAY
public static final long DEFAULT_DELAY
- The default delay between every file modification check, set to 6
seconds.
- See Also:
- Constant Field Values
filename
protected String filename
- The name of the file to observe for changes.
delay
protected long delay
- The delay to observe between every check. By default set
DEFAULT_DELAY
.
FileWatchdog
protected FileWatchdog()
FileWatchdog
protected FileWatchdog(String filename)
initialize
protected void initialize(String filename)
setDelay
public void setDelay(long delay)
- Sets the delay to observe between each check of the file changes.
- Parameters:
delay
- - The delay in milliseconds, in the case of a
negative value the further execution is interrupted.
doOnChange
protected abstract void doOnChange()
checkAndConfigure
protected void checkAndConfigure()
run
public void run()
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
Copyright © 2000-2012 Ontopia.