Class WatchManager
- java.lang.Object
- 
- org.apache.zookeeper.server.watch.WatchManager
 
- 
- All Implemented Interfaces:
- IWatchManager
 
 public class WatchManager extends Object implements IWatchManager This class manages watches. It allows watches to be associated with a string and removes watchers and their watches in addition to managing triggers.
- 
- 
Constructor SummaryConstructors Constructor Description WatchManager()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddWatch(String path, Watcher watcher)Add watch to specific path.booleanaddWatch(String path, Watcher watcher, WatcherMode watcherMode)Add watch to specific path.booleancontainsWatcher(String path, Watcher watcher)Checks the specified watcher exists for the given path.voiddumpWatches(PrintWriter pwriter, boolean byPath)String representation of watches.intgetRecursiveWatchQty()Return the current number of recursive watchersWatchesReportgetWatches()Returns a watch report.WatchesPathReportgetWatchesByPath()Returns a watch report by path.WatchesSummarygetWatchesSummary()Returns a watch summary.booleanremoveWatcher(String path, Watcher watcher)Removes the specified watcher for the given path.voidremoveWatcher(Watcher watcher)The entry to remove the watcher when the cnxn is closed.voidshutdown()Clean up the watch manager.intsize()Get the size of watchers.StringtoString()WatcherOrBitSettriggerWatch(String path, Watcher.Event.EventType type, List<ACL> acl)Distribute the watch event for the given path.WatcherOrBitSettriggerWatch(String path, Watcher.Event.EventType type, List<ACL> acl, WatcherOrBitSet supress)Distribute the watch event for the given path, but ignore those suppressed ones.
 
- 
- 
- 
Method Detail- 
sizepublic int size() Description copied from interface:IWatchManagerGet the size of watchers.- Specified by:
- sizein interface- IWatchManager
- Returns:
- the watchers number managed in this class.
 
 - 
addWatchpublic boolean addWatch(String path, Watcher watcher) Description copied from interface:IWatchManagerAdd watch to specific path.- Specified by:
- addWatchin interface- IWatchManager
- Parameters:
- path- znode path
- watcher- watcher object reference
- Returns:
- true if the watcher added is not already present
 
 - 
addWatchpublic boolean addWatch(String path, Watcher watcher, WatcherMode watcherMode) Description copied from interface:IWatchManagerAdd watch to specific path.- Specified by:
- addWatchin interface- IWatchManager
- Parameters:
- path- znode path
- watcher- watcher object reference
- watcherMode- the watcher mode to use
- Returns:
- true if the watcher added is not already present
 
 - 
removeWatcherpublic void removeWatcher(Watcher watcher) Description copied from interface:IWatchManagerThe entry to remove the watcher when the cnxn is closed.- Specified by:
- removeWatcherin interface- IWatchManager
- Parameters:
- watcher- watcher object reference
 
 - 
triggerWatchpublic WatcherOrBitSet triggerWatch(String path, Watcher.Event.EventType type, List<ACL> acl) Description copied from interface:IWatchManagerDistribute the watch event for the given path.- Specified by:
- triggerWatchin interface- IWatchManager
- Parameters:
- path- znode path
- type- the watch event type
- acl- ACL of the znode in path
- Returns:
- the watchers have been notified
 
 - 
triggerWatchpublic WatcherOrBitSet triggerWatch(String path, Watcher.Event.EventType type, List<ACL> acl, WatcherOrBitSet supress) Description copied from interface:IWatchManagerDistribute the watch event for the given path, but ignore those suppressed ones.- Specified by:
- triggerWatchin interface- IWatchManager
- Parameters:
- path- znode path
- type- the watch event type
- supress- the suppressed watcher set
- Returns:
- the watchers have been notified
 
 - 
dumpWatchespublic void dumpWatches(PrintWriter pwriter, boolean byPath) Description copied from interface:IWatchManagerString representation of watches. Warning, may be large!- Specified by:
- dumpWatchesin interface- IWatchManager
- Parameters:
- pwriter- the writer to dump the watches
- byPath- iff true output watches by paths, otw output watches by connection
 
 - 
containsWatcherpublic boolean containsWatcher(String path, Watcher watcher) Description copied from interface:IWatchManagerChecks the specified watcher exists for the given path.- Specified by:
- containsWatcherin interface- IWatchManager
- Parameters:
- path- znode path
- watcher- watcher object reference
- Returns:
- true if the watcher exists, false otherwise
 
 - 
removeWatcherpublic boolean removeWatcher(String path, Watcher watcher) Description copied from interface:IWatchManagerRemoves the specified watcher for the given path.- Specified by:
- removeWatcherin interface- IWatchManager
- Parameters:
- path- znode path
- watcher- watcher object reference
- Returns:
- true if the watcher successfully removed, false otherwise
 
 - 
getWatchespublic WatchesReport getWatches() Description copied from interface:IWatchManagerReturns a watch report.- Specified by:
- getWatchesin interface- IWatchManager
- Returns:
- watch report
- See Also:
- WatchesReport
 
 - 
getWatchesByPathpublic WatchesPathReport getWatchesByPath() Description copied from interface:IWatchManagerReturns a watch report by path.- Specified by:
- getWatchesByPathin interface- IWatchManager
- Returns:
- watch report
- See Also:
- WatchesPathReport
 
 - 
getWatchesSummarypublic WatchesSummary getWatchesSummary() Description copied from interface:IWatchManagerReturns a watch summary.- Specified by:
- getWatchesSummaryin interface- IWatchManager
- Returns:
- watch summary
- See Also:
- WatchesSummary
 
 - 
shutdownpublic void shutdown() Description copied from interface:IWatchManagerClean up the watch manager.- Specified by:
- shutdownin interface- IWatchManager
 
 - 
getRecursiveWatchQtypublic int getRecursiveWatchQty() Description copied from interface:IWatchManagerReturn the current number of recursive watchers- Specified by:
- getRecursiveWatchQtyin interface- IWatchManager
- Returns:
- qty
 
 
- 
 
-