Java Code Examples for com.twitter.thrift.Status#ALIVE

The following examples show how to use com.twitter.thrift.Status#ALIVE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NameServerSet.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
private ServiceInstance endpointAddressToServiceInstance(Address endpointAddress) {
    if (endpointAddress instanceof Address.Inet) {
        InetSocketAddress inetSocketAddress = ((Address.Inet) endpointAddress).addr();
        Endpoint endpoint = new Endpoint(inetSocketAddress.getHostString(), inetSocketAddress.getPort());
        HashMap<String, Endpoint> map = new HashMap<String, Endpoint>();
        map.put("thrift", endpoint);
        return new ServiceInstance(
            endpoint,
            map,
            Status.ALIVE);
    } else {
        logger.error("We expect InetSocketAddress while the resolved address {} was {}",
                    endpointAddress, endpointAddress.getClass());
        throw new UnsupportedOperationException("invalid endpoint address: " + endpointAddress);
    }
}
 
Example 2
Source File: NameServerSet.java    From distributedlog with Apache License 2.0 6 votes vote down vote up
private ServiceInstance endpointAddressToServiceInstance(Address endpointAddress) {
    if (endpointAddress instanceof Address.Inet) {
        InetSocketAddress inetSocketAddress = ((Address.Inet) endpointAddress).addr();
        Endpoint endpoint = new Endpoint(inetSocketAddress.getHostString(), inetSocketAddress.getPort());
        HashMap<String, Endpoint> map = new HashMap<String, Endpoint>();
        map.put("thrift", endpoint);
        return new ServiceInstance(
            endpoint,
            map,
            Status.ALIVE);
    } else {
        logger.error("We expect InetSocketAddress while the resolved address {} was {}",
                    endpointAddress, endpointAddress.getClass());
        throw new UnsupportedOperationException("invalid endpoint address: " + endpointAddress);
    }
}