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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(Listener listener)Registers new listenervoidCalled periodically byResourceWatcherServiceso resource watcher can check the resourceprotected abstract voidWill be called periodicallyprotected abstract voiddoInit()Will be called once on initializationvoidinit()Called once when the resource watcher is added toResourceWatcherServiceReturns a list of listenersvoidUnregisters a listener
-
Constructor Details
-
AbstractResourceWatcher
public AbstractResourceWatcher()
-
-
Method Details
-
init
Description copied from interface:ResourceWatcherCalled once when the resource watcher is added toResourceWatcherService- Specified by:
initin interfaceResourceWatcher- Throws:
IOException
-
checkAndNotify
Description copied from interface:ResourceWatcherCalled periodically byResourceWatcherServiceso resource watcher can check the resource- Specified by:
checkAndNotifyin 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
-