本文整理汇总了Java中com.spotify.helios.serviceregistration.ServiceRegistration.Endpoint方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceRegistration.Endpoint方法的具体用法?Java ServiceRegistration.Endpoint怎么用?Java ServiceRegistration.Endpoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.spotify.helios.serviceregistration.ServiceRegistration
的用法示例。
在下文中一共展示了ServiceRegistration.Endpoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import com.spotify.helios.serviceregistration.ServiceRegistration; //导入方法依赖的package包/类
@Override
public ServiceRegistrationHandle register(final ServiceRegistration registration) {
final ServiceRegistrationHandle newHandle = new ServiceRegistrationHandle() {};
handles.put(newHandle, registration);
for (final ServiceRegistration.Endpoint endpoint : registration.getEndpoints()) {
if (!endpoints.add(endpoint.getName())) {
log.error("Endpoint names must be unique since they map to a Consul Service ID. " +
"'{}' already present.", endpoint.getName());
}
}
try {
sendRegistration(registration);
} catch (Exception e) {
log.warn("Error performing registration", e);
}
return newHandle;
}
示例2: sendRegistration
import com.spotify.helios.serviceregistration.ServiceRegistration; //导入方法依赖的package包/类
private void sendRegistration(ServiceRegistration registration)
throws JsonProcessingException {
for (final ServiceRegistration.Endpoint endpoint : registration.getEndpoints()) {
consulClient.register(serviceUtil.createService(endpoint));
}
}
示例3: sendDeRegistration
import com.spotify.helios.serviceregistration.ServiceRegistration; //导入方法依赖的package包/类
private void sendDeRegistration(ServiceRegistrationHandle handle) {
final ServiceRegistration registration = handles.get(handle);
if (registration == null) {
return;
}
for (ServiceRegistration.Endpoint endpoint : registration.getEndpoints()) {
consulClient.deregister(endpoint.getName());
endpoints.remove(endpoint.getName());
}
}