Class AbstractFileWatchingService

java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.common.file.AbstractFileWatchingService
All Implemented Interfaces:
Closeable, AutoCloseable, LifecycleComponent, Releasable
Direct Known Subclasses:
MasterNodeFileWatchingService

public abstract class AbstractFileWatchingService extends AbstractLifecycleComponent
A skeleton service for watching and reacting to files changing in a directory

A file watching service watches for changes to a particular directory. There are two assumptions about the file structure:

  1. The directory may or may not exist.
  2. The directory's parent directory must always exist.

For example, if the watched directory is /usr/elastic/elasticsearch/conf/special, then /usr/elastic/elasticsearch/conf must exist, but special and any files in that directory may be created, updated, or deleted during runtime.

What this class does not do is define what should happen after the directory changes. An implementation class should override processFileChanges(Path) to define the correct behavior.