public class HTTPFileWatcher extends FileWatcher
Initially this thread will be a daemon thread. This can be changed by
calling Thread.setDaemon(boolean).
FileWatcher.ListenerThread.State, Thread.UncaughtExceptionHandler_filePaths, _lastModifiedMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
HTTPFileWatcher(String[] urls,
int interval,
FileWatcher.Listener listener)
Creates a new
HTTPFileWatcher for the specified set of URLs,
with the specified interval. |
HTTPFileWatcher(String url,
FileWatcher.Listener listener)
Creates a new
HTTPFileWatcher for the specified URL. |
HTTPFileWatcher(String url,
int interval,
FileWatcher.Listener listener)
Creates a new
HTTPFileWatcher for the specified URL, with the
specified interval. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
firstCheck()
Performs the first check on the file to determine the date the file was
last modified.
|
protected long |
getLastModified()
Gets the time at which the last file was modified.
|
protected void |
storeFiles(String[] files)
Stores the files in a class variable.
|
check, end, getInterval, run, setIntervalactiveCount, 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, yieldpublic HTTPFileWatcher(String url, FileWatcher.Listener listener) throws IllegalArgumentException
HTTPFileWatcher for the specified URL.
The interval must be set before the thread can be started.
url - the name of the URL to watch, cannot be null.listener - the object to notify on events, cannot be null.IllegalArgumentException - if url == null || listener == nullpublic HTTPFileWatcher(String url, int interval, FileWatcher.Listener listener) throws IllegalArgumentException
HTTPFileWatcher for the specified URL, with the
specified interval.url - the name of the URL to watch, cannot be null.interval - the interval in seconds, must be greater than or equal to 0.
if the interval is 0 the interval must be set before the thread can
be started.listener - the object to notify on events, cannot be null.IllegalArgumentException - if url == null || listener == null || interval < 0public HTTPFileWatcher(String[] urls, int interval, FileWatcher.Listener listener) throws IllegalArgumentException
HTTPFileWatcher for the specified set of URLs,
with the specified interval.urls - the name of the URLs to watch, cannot be null.
It should also have at least one URL and none of the URLs should be null.interval - the interval in seconds, must be greater than or equal to 0.
if the interval is 0 the interval must be set before the thread can
be started.listener - the object to notify on events, cannot be null.IllegalArgumentException - if urls == null || listener == null || interval < 0 || urls.length < 1
or if one of the URL is null.protected void storeFiles(String[] files)
FileWatcherstoreFiles in class FileWatcherfiles - the String files to check, cannot be null.protected void firstCheck()
FileWatcherSecurityException, then this
exception is logged and ignored.firstCheck in class FileWatcherprotected long getLastModified()
throws SecurityException
FileWatchergetLastModified in class FileWatcherSecurityException - if one of the file could not be read because of a security issue.See http://www.xins.org/.