use of org.apache.curator.x.discovery.ServiceInstanceBuilder in project dubbo by alibaba.
the class CuratorFrameworkUtils method build.
public static org.apache.curator.x.discovery.ServiceInstance<ZookeeperInstance> build(ServiceInstance serviceInstance) {
ServiceInstanceBuilder builder = null;
String serviceName = serviceInstance.getServiceName();
String host = serviceInstance.getHost();
int port = serviceInstance.getPort();
Map<String, String> metadata = serviceInstance.getMetadata();
String id = generateId(host, port);
ZookeeperInstance zookeeperInstance = new ZookeeperInstance(null, serviceName, metadata);
try {
builder = builder().id(id).name(serviceName).address(host).port(port).payload(zookeeperInstance);
} catch (Exception e) {
throw new RuntimeException(e);
}
return builder.build();
}
Aggregations