Java Code Examples for com.ecwid.consul.v1.health.model.HealthService#getNode()

The following examples show how to use com.ecwid.consul.v1.health.model.HealthService#getNode() . 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: ConsulServerContext.java    From pampas with Apache License 2.0 5 votes vote down vote up
private static String findHost(HealthService healthService) {
    HealthService.Service service = healthService.getService();
    HealthService.Node node = healthService.getNode();

    if (StringUtils.isNotBlank(service.getAddress())) {
        return service.getAddress();
    } else if (StringUtils.isNotBlank(node.getAddress())) {
        return node.getAddress();
    }
    return node.getNode();
}
 
Example 2
Source File: ConsulHelper.java    From dyno with Apache License 2.0 5 votes vote down vote up
public static String findHost(HealthService healthService) {
    HealthService.Service service = healthService.getService();
    HealthService.Node node = healthService.getNode();

    if (StringUtils.isNotBlank(service.getAddress())) {
        return service.getAddress();
    } else if (StringUtils.isNotBlank(node.getAddress())) {
        return node.getAddress();
    }
    return node.getNode();
}
 
Example 3
Source File: ConsulServerUtils.java    From spring-cloud-consul with Apache License 2.0 5 votes vote down vote up
public static String findHost(HealthService healthService) {
	HealthService.Service service = healthService.getService();
	HealthService.Node node = healthService.getNode();

	if (StringUtils.hasText(service.getAddress())) {
		return fixIPv6Address(service.getAddress());
	}
	else if (StringUtils.hasText(node.getAddress())) {
		return fixIPv6Address(node.getAddress());
	}
	return node.getNode();
}