use of com.paascloud.core.registry.zookeeper.ZookeeperRegistryCenter in project paascloud-master by paascloud.
the class RegistryCenterFactory method createCoordinatorRegistryCenter.
/**
* 创建注册中心.
*
* @param zookeeperProperties the zookeeper properties
*
* @return 注册中心对象 coordinator registry center
*/
public static CoordinatorRegistryCenter createCoordinatorRegistryCenter(ZookeeperProperties zookeeperProperties) {
Hasher hasher = Hashing.md5().newHasher().putString(zookeeperProperties.getZkAddressList(), Charsets.UTF_8);
HashCode hashCode = hasher.hash();
CoordinatorRegistryCenter result = REG_CENTER_REGISTRY.get(hashCode);
if (null != result) {
return result;
}
result = new ZookeeperRegistryCenter(zookeeperProperties);
result.init();
REG_CENTER_REGISTRY.put(hashCode, result);
return result;
}
Aggregations