public class FileMonitorManager extends Object implements Runnable
FileMonitor objects.| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_DELAY |
static int |
DEFAULT_MAX_FILES |
| Constructor and Description |
|---|
FileMonitorManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addFileMonitor(FileMonitor aMonitor)
Add a new
FileMonitor. |
FileMonitor |
createFileMonitor(IFileMonitorCallback aListener)
Create a new
FileMonitor based on the passed file listener. |
ICommonsList<FileMonitor> |
getAllFileMonitors() |
int |
getChecksPerRun()
get the number of files to check per run.
|
long |
getDelay()
Get the delay between runs.
|
int |
getFileMonitorCount() |
boolean |
isRunning() |
EChange |
removeFileMonitor(FileMonitor aMonitor)
Remove a
FileMonitor. |
void |
run()
Asks the agent for each file being monitored to check its file for changes.
|
FileMonitorManager |
setChecksPerRun(int nChecksPerRun)
set the number of files to check per run. a additional delay will be added
if there are more files to check
|
FileMonitorManager |
setDelay(long nDelay)
Set the delay between runs.
|
void |
start()
Starts monitoring the files
|
void |
stop()
Stops monitoring the files.
|
public static final long DEFAULT_DELAY
public static final int DEFAULT_MAX_FILES
public long getDelay()
@Nonnull public FileMonitorManager setDelay(long nDelay)
nDelay - The delay period in milliseconds.public int getChecksPerRun()
@Nonnull public FileMonitorManager setChecksPerRun(int nChecksPerRun)
nChecksPerRun - a value less than 1 will disable this feature@Nonnull public FileMonitor createFileMonitor(@Nonnull IFileMonitorCallback aListener)
FileMonitor based on the passed file listener.aListener - The listener to be used. May not be null.FileMonitor that was already added.addFileMonitor(FileMonitor)public void addFileMonitor(@Nonnull FileMonitor aMonitor)
FileMonitor.aMonitor - The monitor to be added. May not be null.@Nonnull public EChange removeFileMonitor(@Nullable FileMonitor aMonitor)
FileMonitor.aMonitor - The monitor to be remove. May be null.EChange@Nonnull @ReturnsMutableCopy public ICommonsList<FileMonitor> getAllFileMonitors()
@Nonnegative public int getFileMonitorCount()
FileMonitor objects. Always ≥ 0.public void start()
IllegalStateException - if the monitoring is already runningisRunning(),
stop()public void stop()
public boolean isRunning()
true if the monitoring thread is running,
false if not.Copyright © 2014–2016 Philip Helger. All rights reserved.