public class WatchManagerOptimized extends Object implements IWatchManager, IDeadWatcherListener
| Constructor and Description |
|---|
WatchManagerOptimized() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addWatch(String path,
Watcher watcher)
Add watch to specific path.
|
boolean |
containsWatcher(String path,
Watcher watcher)
Used in the OpCode.checkWatches, which is a read operation, since read
and write requests are exclusively processed, we don't need to hold
lock here.
|
void |
dumpWatches(PrintWriter pwriter,
boolean byPath)
String representation of watches.
|
Map<Watcher,Set<String>> |
getWatcher2PathesMap()
May cause OOM if there are lots of watches, might better to forbid
it in this class.
|
WatchesReport |
getWatches()
Returns a watch report.
|
WatchesPathReport |
getWatchesByPath()
Iterate through ConcurrentHashMap is 'safe', it will reflect the state
of the map at the time iteration began, may miss update while iterating,
given this is used in the commands to get a general idea of the watches
state, we don't care about missing some update.
|
WatchesSummary |
getWatchesSummary()
Returns a watch summary.
|
void |
processDeadWatchers(Set<Integer> deadWatchers)
Entry for WatcherCleaner to remove dead watchers
|
boolean |
removeWatcher(String path,
Watcher watcher)
Removes the specified watcher for the given path.
|
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.
|
String |
toString() |
WatcherOrBitSet |
triggerWatch(String path,
Watcher.Event.EventType type)
Distribute the watch event for the given path.
|
WatcherOrBitSet |
triggerWatch(String path,
Watcher.Event.EventType type,
WatcherOrBitSet suppress)
Distribute the watch event for the given path, but ignore those
suppressed ones.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddWatch, getRecursiveWatchQtypublic boolean addWatch(String path, Watcher watcher)
IWatchManageraddWatch in interface IWatchManagerpath - znode pathwatcher - watcher object referencepublic boolean containsWatcher(String path, Watcher watcher)
containsWatcher in interface IWatchManagerpath - znode pathwatcher - watcher object referencepublic boolean removeWatcher(String path, Watcher watcher)
IWatchManagerremoveWatcher in interface IWatchManagerpath - znode pathwatcher - watcher object referencepublic void removeWatcher(Watcher watcher)
IWatchManagerremoveWatcher in interface IWatchManagerwatcher - watcher object referencepublic void processDeadWatchers(Set<Integer> deadWatchers)
processDeadWatchers in interface IDeadWatcherListenerdeadWatchers - the watchers need to be removedpublic WatcherOrBitSet triggerWatch(String path, Watcher.Event.EventType type)
IWatchManagertriggerWatch in interface IWatchManagerpath - znode pathtype - the watch event typepublic WatcherOrBitSet triggerWatch(String path, Watcher.Event.EventType type, WatcherOrBitSet suppress)
IWatchManagertriggerWatch in interface IWatchManagerpath - znode pathtype - the watch event typesuppress - the suppressed watcher setpublic int size()
IWatchManagersize in interface IWatchManagerpublic void shutdown()
IWatchManagershutdown in interface IWatchManagerpublic WatchesSummary getWatchesSummary()
IWatchManagergetWatchesSummary in interface IWatchManagerWatchesSummarypublic WatchesReport getWatches()
IWatchManagergetWatches in interface IWatchManagerWatchesReportpublic WatchesPathReport getWatchesByPath()
getWatchesByPath in interface IWatchManagerWatchesPathReportpublic Map<Watcher,Set<String>> getWatcher2PathesMap()
public void dumpWatches(PrintWriter pwriter, boolean byPath)
IWatchManagerdumpWatches in interface IWatchManagerpwriter - the writer to dump the watchesbyPath - iff true output watches by paths, otw output
watches by connectionCopyright © 2008–2021 The Apache Software Foundation. All rights reserved.