Interface Watcher
-
- All Known Implementing Classes:
AbstractWatcher,ConfigurationFileWatcher,HttpWatcher,WrappedFileWatcher
public interface WatcherWatches for changes in a Source and performs an action when it is modified.- See Also:
WatchManager
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCATEGORYstatic java.lang.StringELEMENT_TYPE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetLastModified()Returns the time the source was last modified or 0 if it is not available.java.util.List<ConfigurationListener>getListeners()Returns the list of listeners for this configuration.SourcegetSource()Returns the Source being monitored.booleanisModified()Periodically called to determine if the configuration has been modified.voidmodified()Called when the configuration has been modified.WatchernewWatcher(Reconfigurable reconfigurable, java.util.List<ConfigurationListener> listeners, long lastModifiedMillis)Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.voidwatching(Source source)Called when the Watcher is registered.
-
-
-
Field Detail
-
CATEGORY
static final java.lang.String CATEGORY
- See Also:
- Constant Field Values
-
ELEMENT_TYPE
static final java.lang.String ELEMENT_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getListeners
java.util.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
void watching(Source source)
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, java.util.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.
-
-