目录
一、Watcher
Watcher监听器,zookeeper数据节点实现监听机制,监听数据和节点变化事件。Watcher接口中只有一个process(WatchedEvent event)方法,包含两个内部类,Event(具体事件)和WatcherType(监听类型)。
public interface Watcher {
public interface Event {
public enum KeeperState {
Unknown (-1),
Disconnected (0),
NoSyncConnected (1),
SyncConnected (3),
AuthFailed (4),
ConnectedReadOnly (5),
SaslAuthenticated(6),
Expired (-112),
Closed (7);
private final int intValue;
KeeperState(int intValue) {
this.intValue = intValue;
}
public enum EventType {
None (-1),
NodeCreated (1),
NodeDeleted (2),