注:Dubbo版本是2.5.7java
圖1 ZookeeperRegistry類繼承圖ide
RegistryProtocol的export方法以下。url
圖2 RegistryProtocol的export方法code
圖2中registry.register(registedProviderUrl);調用的是FailbackRegistry的register方法,以下圖3所示。繼承
圖3 FailbackRegistry的register方法get
圖3中,調用了doRegister(url),這個方法的實現是在ZookeeperRegistry中,以下所示。io
protected void doRegister(URL url) { try { zkClient.create(toUrlPath(url), url.getParameter(Constants.DYNAMIC_KEY, true)); } catch (Throwable e) { throw new RpcException("Failed to register " + url + " to zookeeper " + getUrl() + ", cause: " + e.getMessage(), e); } }
以後就到zkClient的節點create,在此就不分析了。class