天天看點

dubbo對zookeeper的應用

1.定義ZookeeperClient接口,抽象類AbstractZookeeperClient實作ZookeeperClient接口。ZkclientZookeeperClient繼承 AbstractZookeeperClient抽象類。使用zkclient類庫。作為預設的實作
2.程式啟動,構造Ephemeral節點
3.com.alibaba.dubbo.config.ServiceConfig負責生成節點内容。使用InetAddress.getLocalHost().getHostAddress();作為擷取本地ip的方法,如果本機ip配置不正确,可能存在隐患
4.訂閱節點變化,實作IZkStateListener的handleNewSession方法
5.訂閱孩子節點變化,實作負載均衡