org.springsource.loaded.agent
Class FileSystemWatcher

java.lang.Object
  extended by org.springsource.loaded.agent.FileSystemWatcher

public class FileSystemWatcher
extends java.lang.Object

A simple watcher for the file system. Uses a thread to keep an eye on a number of files and calls back registered interested parties when a change is observed. The thread only starts when there is something to watch. The thread is given a name indicating the classloader for which it is watching files. Once it starts to watch files the name will be enhanced to indicate how many.

Since:
0.5.0

Constructor Summary
FileSystemWatcher(FileChangeListener listener, int typeRegistryId, java.lang.String classloadername)
           
 
Method Summary
 void register(java.io.File fileToMonitor)
          Add a new file to the list of those being monitored.
 void setPaused(boolean shouldBePaused)
          Enables the filesystem watching to be paused/unpaused.
 void shutdown()
          Shutdown the thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemWatcher

public FileSystemWatcher(FileChangeListener listener,
                         int typeRegistryId,
                         java.lang.String classloadername)
Method Detail

shutdown

public void shutdown()
Shutdown the thread.


register

public void register(java.io.File fileToMonitor)
Add a new file to the list of those being monitored. If the file is something that can be watched, then this method will cause the thread to start (if it hasn't already been started).

Parameters:
fileToMonitor - the file to start monitor

setPaused

public void setPaused(boolean shouldBePaused)
Enables the filesystem watching to be paused/unpaused.

Parameters:
shouldBePaused - watching should be paused?