Interface Watcher
- All Known Implementing Classes:
AbstractWatcher,ConfigurationFileWatcher,HttpWatcher,WrappedFileWatcher
public interface Watcher
Watches for changes in a Source and performs an action when it is modified.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the time the source was last modified or 0 if it is not available.Returns the list of listeners for this configuration.Returns the Source being monitored.booleanPeriodically called to determine if the configuration has been modified.voidmodified()Called when the configuration has been modified.newWatcher(Reconfigurable reconfigurable, List<ConfigurationListener> listeners, long lastModifiedMillis) Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.voidCalled when the Watcher is registered.
-
Field Details
-
CATEGORY
- See Also:
-
ELEMENT_TYPE
- See Also:
-
-
Method Details
-
getListeners
List<ConfigurationListener> getListeners()Returns the list of listeners for this configuration.- Returns:
- The list of listeners.
-
modified
void modified()Called when the configuration has been modified. -
isModified
boolean isModified()Periodically called to determine if the configuration has been modified.- Returns:
- true if the configuration was modified, false otherwise.
-
getLastModified
long getLastModified()Returns the time the source was last modified or 0 if it is not available.- Returns:
- the time the source was last modified.
-
watching
Called when the Watcher is registered.- Parameters:
source- the Source that is being watched.
-
getSource
Source getSource()Returns the Source being monitored.- Returns:
- the Source.
-
newWatcher
Watcher newWatcher(Reconfigurable reconfigurable, List<ConfigurationListener> listeners, long lastModifiedMillis) Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.- Parameters:
reconfigurable- The Reconfigurable.listeners- the listeners.lastModifiedMillis- The time the resource was last modified in milliseconds.- Returns:
- A new Watcher.
-