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


Java ServiceInstanceBuilder.name方法代码示例

本文整理汇总了Java中org.apache.curator.x.discovery.ServiceInstanceBuilder.name方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceInstanceBuilder.name方法的具体用法?Java ServiceInstanceBuilder.name怎么用?Java ServiceInstanceBuilder.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.curator.x.discovery.ServiceInstanceBuilder的用法示例。


在下文中一共展示了ServiceInstanceBuilder.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readInstance

import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
static<T> ServiceInstance<T> readInstance(JsonNode node, DiscoveryContext<T> context) throws Exception
{
    ServiceInstanceBuilder<T> builder = ServiceInstance.builder();

    builder.name(node.get("name").asText());
    builder.id(node.get("id").asText());
    builder.address(node.get("address").asText());
    builder.registrationTimeUTC(node.get("registrationTimeUTC").asLong());
    builder.serviceType(ServiceType.valueOf(node.get("serviceType").asText()));
    builder.payload(context.unMarshallJson(node.get("payload")));

    Integer port = getInteger(node, "port");
    Integer sslPort = getInteger(node, "sslPort");
    if ( port != null )
    {
        builder.port(port);
    }
    if ( sslPort != null )
    {
        builder.sslPort(sslPort);
    }

    return builder.build();
}
 
开发者ID:apache,项目名称:curator,代码行数:25,代码来源:JsonServiceInstanceMarshaller.java

示例2: deserialize

import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
@Override
public ServiceInstance<DrillbitEndpoint> deserialize(byte[] bytes) throws Exception {
  DrillServiceInstance i = DrillServiceInstance.parseFrom(bytes);
  ServiceInstanceBuilder<DrillbitEndpoint> b = ServiceInstance.<DrillbitEndpoint>builder();
  b.id(i.getId());
  b.name(ExecConstants.SERVICE_NAME);
  b.registrationTimeUTC(i.getRegistrationTimeUTC());
  b.payload(i.getEndpoint());
  return b.build();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:DrillServiceInstanceHelper.java

示例3: deserialize

import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
@Override
public ServiceInstance<NodeEndpoint> deserialize(byte[] bytes) throws Exception {
  DremioServiceInstance i = DremioServiceInstance.parseFrom(bytes);
  ServiceInstanceBuilder<NodeEndpoint> b = ServiceInstance.<NodeEndpoint>builder();
  b.id(i.getId());
  b.name(i.getName());
  b.registrationTimeUTC(i.getRegistrationTimeUTC());
  b.payload(i.getEndpoint());
  return b.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:ServiceInstanceHelper.java

示例4: deserialize

import org.apache.curator.x.discovery.ServiceInstanceBuilder; //导入方法依赖的package包/类
@Override
public ServiceInstance<T> deserialize(final byte[] pBytes) throws Exception {
    final ByteArrayInputStream bais = new ByteArrayInputStream(pBytes);
    final JsonNode rootNode = mMapper.readTree(bais);
    final ServiceInstanceBuilder<T> builder = ServiceInstance.builder();
    {
        final String address = getTextField(rootNode, "address");
        if (address != null) {
            builder.address(address);
        }
    }
    {
        final String id = getTextField(rootNode, "id");
        if (id != null) {
            builder.id(id);
        }
    }
    {
        final String name = getTextField(rootNode, "name");
        if (name != null) {
            builder.name(name);
        }
    }
    {
        final Integer port = getIntegerField(rootNode, "port");
        if (port != null) {
            builder.port(port);
        }
    }
    {
        final Integer sslPort = getIntegerField(rootNode, "sslPort");
        if (sslPort != null) {
            builder.sslPort(sslPort);
        }
    }
    {
        final Long registrationTimeUTC = getLongField(rootNode, "registrationTimeUTC");
        if (registrationTimeUTC != null) {
            builder.registrationTimeUTC(registrationTimeUTC);
        }
    }
    {
        final T payload = getObject(rootNode, "payload", mPayloadClass);
        if (payload != null) {
            builder.payload(payload);
        }
    }
    {
        final ServiceType serviceType = getObject(rootNode, "serviceType", ServiceType.class);
        if (serviceType != null) {
            builder.serviceType(serviceType);
        }
    }
    {
        final UriSpec uriSpec = getObject(rootNode, "uriSpec", UriSpec.class);
        if (uriSpec != null) {
            builder.uriSpec(uriSpec);
        }
    }
    return builder.build();
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:62,代码来源:FixedJsonInstanceSerializer.java


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