当前位置: 首页>>代码示例>>Java>>正文


Java ServiceRegistration.Endpoint方法代码示例

本文整理汇总了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;
}
 
开发者ID:SVT,项目名称:helios-consul,代码行数:20,代码来源:ConsulServiceRegistrar.java

示例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));
    }
}
 
开发者ID:SVT,项目名称:helios-consul,代码行数:8,代码来源:ConsulServiceRegistrar.java

示例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());
    }
}
 
开发者ID:SVT,项目名称:helios-consul,代码行数:11,代码来源:ConsulServiceRegistrar.java


注:本文中的com.spotify.helios.serviceregistration.ServiceRegistration.Endpoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。