一、前言
前面已經(jīng)分析了Watcher機(jī)制中的第一部分,即在org.apache.zookeeper下的相關(guān)類,接著來分析org.apache.zookeeper.server下的WatchManager類。
二、WatchManager源碼分析
2.1 類的屬性
public class WatchManager { // Logger private static final Logger LOG = LoggerFactory.getLogger(WatchManager.class); // watcher表 private final HashMap<String, HashSet<Watcher>> watchTable = new HashMap<String, HashSet<Watcher>>(); // watcher到節(jié)點(diǎn)路徑的映射 private final HashMap<Watcher, HashSet<String>> watch2Paths = new HashMap<Watcher, HashSet<String>>(); }
網(wǎng)友評論