Interface IWatchManager
-
- All Known Implementing Classes:
WatchManager
,WatchManagerOptimized
public interface IWatchManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
addWatch(String path, Watcher watcher)
Add watch to specific path.default boolean
addWatch(String path, Watcher watcher, WatcherMode watcherMode)
Add watch to specific path.boolean
containsWatcher(String path, Watcher watcher)
Checks the specified watcher exists for the given path.default boolean
containsWatcher(String path, Watcher watcher, WatcherMode watcherMode)
Checks the specified watcher exists for the given path and mode.void
dumpWatches(PrintWriter pwriter, boolean byPath)
String representation of watches.WatchesReport
getWatches()
Returns a watch report.WatchesPathReport
getWatchesByPath()
Returns a watch report by path.WatchesSummary
getWatchesSummary()
Returns a watch summary.boolean
removeWatcher(String path, Watcher watcher)
Removes the specified watcher for the given path.default boolean
removeWatcher(String path, Watcher watcher, WatcherMode watcherMode)
Removes the specified watcher for the given path and mode.void
removeWatcher(Watcher watcher)
The entry to remove the watcher when the cnxn is closed.void
shutdown()
Clean up the watch manager.int
size()
Get the size of watchers.WatcherOrBitSet
triggerWatch(String path, Watcher.Event.EventType type, long zxid)
Distribute the watch event for the given path.WatcherOrBitSet
triggerWatch(String path, Watcher.Event.EventType type, long zxid, WatcherOrBitSet suppress)
Distribute the watch event for the given path, but ignore those suppressed ones.
-
-
-
Method Detail
-
addWatch
boolean addWatch(String path, Watcher watcher)
Add watch to specific path.- Parameters:
path
- znode pathwatcher
- watcher object reference- Returns:
- true if the watcher added is not already present
-
addWatch
default boolean addWatch(String path, Watcher watcher, WatcherMode watcherMode)
Add watch to specific path.- Parameters:
path
- znode pathwatcher
- watcher object referencewatcherMode
- the watcher mode to use- Returns:
- true if the watcher added is not already present
-
containsWatcher
boolean containsWatcher(String path, Watcher watcher)
Checks the specified watcher exists for the given path.- Parameters:
path
- znode pathwatcher
- watcher object reference- Returns:
- true if the watcher exists, false otherwise
-
containsWatcher
default boolean containsWatcher(String path, Watcher watcher, @Nullable WatcherMode watcherMode)
Checks the specified watcher exists for the given path and mode.- Parameters:
path
- znode pathwatcher
- watcher object referencewatcherMode
- watcher mode, null for any mode- Returns:
- true if the watcher exists, false otherwise
-
removeWatcher
boolean removeWatcher(String path, Watcher watcher)
Removes the specified watcher for the given path.- Parameters:
path
- znode pathwatcher
- watcher object reference- Returns:
- true if the watcher successfully removed, false otherwise
-
removeWatcher
default boolean removeWatcher(String path, Watcher watcher, WatcherMode watcherMode)
Removes the specified watcher for the given path and mode.- Parameters:
path
- znode pathwatcher
- watcher object referencewatcherMode
- watcher mode, null to remove all modes- Returns:
- true if the watcher successfully removed, false otherwise
-
removeWatcher
void removeWatcher(Watcher watcher)
The entry to remove the watcher when the cnxn is closed.- Parameters:
watcher
- watcher object reference
-
triggerWatch
WatcherOrBitSet triggerWatch(String path, Watcher.Event.EventType type, long zxid)
Distribute the watch event for the given path.- Parameters:
path
- znode pathtype
- the watch event typezxid
- the zxid for the corresponding change that triggered this event- Returns:
- the watchers have been notified
-
triggerWatch
WatcherOrBitSet triggerWatch(String path, Watcher.Event.EventType type, long zxid, WatcherOrBitSet suppress)
Distribute the watch event for the given path, but ignore those suppressed ones.- Parameters:
path
- znode pathtype
- the watch event typezxid
- the zxid for the corresponding change that triggered this eventsuppress
- the suppressed watcher set- Returns:
- the watchers have been notified
-
size
int size()
Get the size of watchers.- Returns:
- the watchers number managed in this class.
-
shutdown
void shutdown()
Clean up the watch manager.
-
getWatchesSummary
WatchesSummary getWatchesSummary()
Returns a watch summary.- Returns:
- watch summary
- See Also:
WatchesSummary
-
getWatches
WatchesReport getWatches()
Returns a watch report.- Returns:
- watch report
- See Also:
WatchesReport
-
getWatchesByPath
WatchesPathReport getWatchesByPath()
Returns a watch report by path.- Returns:
- watch report
- See Also:
WatchesPathReport
-
dumpWatches
void dumpWatches(PrintWriter pwriter, boolean byPath)
String representation of watches. Warning, may be large!- Parameters:
pwriter
- the writer to dump the watchesbyPath
- iff true output watches by paths, otw output watches by connection
-
-