Package org.elasticsearch.watcher
Class AbstractResourceWatcher<Listener>
java.lang.Object
org.elasticsearch.watcher.AbstractResourceWatcher<Listener>
- All Implemented Interfaces:
ResourceWatcher
- Direct Known Subclasses:
FileWatcher
Abstract resource watcher framework, which handles adding and removing listeners
and calling resource observer.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener(Listener listener)
Registers new listenervoid
Called periodically byResourceWatcherService
so resource watcher can check the resourceprotected abstract void
Will be called periodicallyprotected abstract void
doInit()
Will be called once on initializationvoid
init()
Called once when the resource watcher is added toResourceWatcherService
Returns a list of listenersvoid
Unregisters a listener
-
Constructor Details
-
AbstractResourceWatcher
public AbstractResourceWatcher()
-
-
Method Details
-
init
Description copied from interface:ResourceWatcher
Called once when the resource watcher is added toResourceWatcherService
- Specified by:
init
in interfaceResourceWatcher
- Throws:
IOException
-
checkAndNotify
Description copied from interface:ResourceWatcher
Called periodically byResourceWatcherService
so resource watcher can check the resource- Specified by:
checkAndNotify
in interfaceResourceWatcher
- Throws:
IOException
-
addListener
Registers new listener -
remove
Unregisters a listener -
listeners
Returns a list of listeners -
doInit
Will be called once on initialization- Throws:
IOException
-
doCheckAndNotify
Will be called periodicallyImplementing watcher should check resource and notify all
listeners()
.- Throws:
IOException
-