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


Java ServiceInstance.getPayload方法代码示例

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


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

示例1: onInstanceAdded

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
@Override
protected void onInstanceAdded(ServiceInstance<RpcPayload> instance) {
    if (!this.instances.contains(instance)) {
        if (instance.getPayload() == null) {
            this.instances.offer(instance);
        } else {
            int count = (int) instance.getPayload().getMaxQps() / BASE_NUM;
            count++;
            LOG.info("Max qps :" + instance.getPayload().getMaxQps()
                    + "  Count" + count);
            for (int i = 0; i < count; i++) {
                this.instances.offer(instance);
            }
        }
        LOG.info("Add an instance to pool:  " + instance);
        this.failedCount.put(instance, new AtomicInteger(0));
    }
}
 
开发者ID:jigsaw-projects,项目名称:jigsaw-payment,代码行数:19,代码来源:StaticQpsTransportPool.java

示例2: createNativeTransport

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
/**
 * 根据rc的设置来确定创建什么类型的transport;
 *
 * @param instance
 * @return
 */
protected TTransport createNativeTransport(
        ServiceInstance<RpcPayload> instance) {
    TSocket socket = new TSocket(instance.getAddress(), instance.getPort());
    socket.setTimeout(socketTimeout);

    RpcPayload server = instance.getPayload();
    if ((server == null) || (server.getTransport() == null)
            || (server.getTransport().equals("socket"))) {
        return socket;
    } else if ("framed-transport".equals(server.getTransport())) {
        return new TFramedTransport(socket);
    }

    // for default, use TSocket;
    return socket;
}
 
开发者ID:jigsaw-projects,项目名称:jigsaw-payment,代码行数:23,代码来源:AbstractTransportPool.java

示例3: gedIPV6FromInstance

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
private String gedIPV6FromInstance(ServiceInstance<T> instance) {
    MetaData metaData = (MetaData) instance.getPayload();
    String addressIPV6 = null;
    if (metaData.getParameters() != null) {
        addressIPV6 = metaData.getParameters().get(IpProtocolVersion.IPV6.getId());
    }
    return addressIPV6;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:9,代码来源:CustomServiceCache.java

示例4: getWeightFromInstance

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
private String getWeightFromInstance(ServiceInstance<T> instance) {
    MetaData metaData = (MetaData) instance.getPayload();
    String weight = null;
    if (metaData.getParameters() != null) {
        weight = metaData.getParameters().get(ServiceProviderUtils.WEIGHT_PARAMETER);
    }
    return weight;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:9,代码来源:CustomServiceCache.java

示例5: getUniqueInstanceKey

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
private static String getUniqueInstanceKey(ServiceInstance<MetaData> instance) {
    if (instance.getPayload() != null && instance.getPayload().getParameters() != null) {
        String ipv4 = instance.getPayload().getParameters().get(IpProtocolVersion.IPV4.getId());
        String ipv6 = instance.getPayload().getParameters().get(IpProtocolVersion.IPV6.getId());

        return ipv4 + ipv6;
    } else {
        return instance.getAddress();
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:11,代码来源:StackServiceProvider.java

示例6: getAddress

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
public static String getAddress(ServiceInstance<MetaData> serviceInstance, IpProtocolVersion version) {
    String result = null;
    if (serviceInstance != null && serviceInstance.getPayload() != null && serviceInstance.getPayload().getParameters() != null) {
        result = serviceInstance.getPayload().getParameters().get(version.getId());
    }
    if (StringUtils.isBlank(result) && version == IpProtocolVersion.IPV4) {
        result = serviceInstance.getAddress();
    }
    return result;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:11,代码来源:ServiceProviderUtils.java

示例7: setStackNameForServiceInstance

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
public static void setStackNameForServiceInstance(ServiceInstance<MetaData> instance, String stackName) {
    if (instance.getPayload() != null) {
        if (instance.getPayload().getParameters() == null) {
            // this is very edge case. Should happen almost never
            log.warn("Service instance without parameters in payload: {}", instance);
            instance.getPayload().setParameters(new HashMap<String, String>());
        }
        instance.getPayload().getParameters().put(STACK_NAME_PARAMETER, stackName);
    } else {
        log.warn("Can't set stackName to service instance without payload: {}", instance);
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:13,代码来源:ServiceProviderUtils.java

示例8: getStackNameFromServiceInstance

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
public static String getStackNameFromServiceInstance(ServiceInstance<MetaData> instance) {
    String stackName = null;
    if (instance.getPayload() != null) {
        if (instance.getPayload().getParameters() != null) {
            stackName = instance.getPayload().getParameters().get(STACK_NAME_PARAMETER);
        }
    } else {
        log.warn("Can't get stackName from service instance without payload: {}", instance);
    }

    return stackName;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:13,代码来源:ServiceProviderUtils.java

示例9: getWeightFromPayload

import org.apache.curator.x.discovery.ServiceInstance; //导入方法依赖的package包/类
public static String getWeightFromPayload(ServiceInstance<MetaData> instance) {
    String weight = null;
    if (instance.getPayload() != null && instance.getPayload().getParameters() != null) {
        weight = instance.getPayload().getParameters().get(ServiceProviderUtils.WEIGHT_PARAMETER);
    }

    return weight;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:9,代码来源:ServiceProviderUtils.java


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