use of org.apache.dubbo.registry.zookeeper.ZookeeperInstance in project dubbo by alibaba.
the class CuratorFrameworkUtils method build.
public static ServiceInstance build(org.apache.curator.x.discovery.ServiceInstance<ZookeeperInstance> instance) {
String name = instance.getName();
String host = instance.getAddress();
int port = instance.getPort();
ZookeeperInstance zookeeperInstance = instance.getPayload();
DefaultServiceInstance serviceInstance = new DefaultServiceInstance(instance.getId(), name, host, port);
serviceInstance.setMetadata(zookeeperInstance.getMetadata());
return serviceInstance;
}
use of org.apache.dubbo.registry.zookeeper.ZookeeperInstance 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