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:
WatchManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
CATEGORY
static String
ELEMENT_TYPE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getLastModified()
Returns the time the source was last modified or 0 if it is not available.List<ConfigurationListener>
getListeners()
Returns the list of listeners for this configuration.Source
getSource()
Returns the Source being monitored.boolean
isModified()
Periodically called to determine if the configuration has been modified.void
modified()
Called when the configuration has been modified.Watcher
newWatcher(Reconfigurable reconfigurable, List<ConfigurationListener> listeners, long lastModifiedMillis)
Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.void
watching(Source source)
Called when the Watcher is registered.
-
-
-
Field Detail
-
CATEGORY
static final String CATEGORY
- See Also:
- Constant Field Values
-
ELEMENT_TYPE
static final String ELEMENT_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
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, 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.
-
-