|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.commons.io.monitor.FileAlterationMonitor
public final class FileAlterationMonitor
A runnable that spawns a monitoring thread triggering any
registered FileAlterationObserver at a specified interval.
FileAlterationObserver| Field Summary | |
|---|---|
private long |
interval
|
private java.util.List<FileAlterationObserver> |
observers
|
private boolean |
running
|
private java.lang.Thread |
thread
|
private java.util.concurrent.ThreadFactory |
threadFactory
|
| Constructor Summary | |
|---|---|
FileAlterationMonitor()
Construct a monitor with a default interval of 10 seconds. |
|
FileAlterationMonitor(long interval)
Construct a monitor with the specified interval. |
|
FileAlterationMonitor(long interval,
FileAlterationObserver... observers)
Construct a monitor with the specified interval and set of observers. |
|
| Method Summary | |
|---|---|
void |
addObserver(FileAlterationObserver observer)
Add a file system observer to this monitor. |
long |
getInterval()
Return the interval. |
java.lang.Iterable<FileAlterationObserver> |
getObservers()
Returns the set of FileAlterationObserver registered with
this monitor. |
void |
removeObserver(FileAlterationObserver observer)
Remove a file system observer from this monitor. |
void |
run()
Run. |
void |
setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Set the thread factory. |
void |
start()
Start monitoring. |
void |
stop()
Stop monitoring. |
void |
stop(long stopInterval)
Stop monitoring. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final long interval
private final java.util.List<FileAlterationObserver> observers
private java.lang.Thread thread
private java.util.concurrent.ThreadFactory threadFactory
private volatile boolean running
| Constructor Detail |
|---|
public FileAlterationMonitor()
public FileAlterationMonitor(long interval)
interval - The amount of time in miliseconds to wait between
checks of the file system
public FileAlterationMonitor(long interval,
FileAlterationObserver... observers)
interval - The amount of time in miliseconds to wait between
checks of the file systemobservers - The set of observers to add to the monitor.| Method Detail |
|---|
public long getInterval()
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
threadFactory - the thread factorypublic void addObserver(FileAlterationObserver observer)
observer - The file system observer to addpublic void removeObserver(FileAlterationObserver observer)
observer - The file system observer to removepublic java.lang.Iterable<FileAlterationObserver> getObservers()
FileAlterationObserver registered with
this monitor.
FileAlterationObserver
public void start()
throws java.lang.Exception
java.lang.Exception - if an error occurs initializing the observer
public void stop()
throws java.lang.Exception
java.lang.Exception - if an error occurs initializing the observer
public void stop(long stopInterval)
throws java.lang.Exception
stopInterval - the amount of time in milliseconds to wait for the thread to finish.
A value of zero will wait until the thread is finished (see Thread.join(long)).
java.lang.Exception - if an error occurs initializing the observerpublic void run()
run in interface java.lang.Runnable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||