本文整理汇总了Java中com.hazelcast.spi.discovery.DiscoveryNode.getPublicAddress方法的典型用法代码示例。如果您正苦于以下问题:Java DiscoveryNode.getPublicAddress方法的具体用法?Java DiscoveryNode.getPublicAddress怎么用?Java DiscoveryNode.getPublicAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hazelcast.spi.discovery.DiscoveryNode
的用法示例。
在下文中一共展示了DiscoveryNode.getPublicAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: determineMyLocalAddress
import com.hazelcast.spi.discovery.DiscoveryNode; //导入方法依赖的package包/类
@Override
@SneakyThrows
public Address determineMyLocalAddress(DiscoveryNode localDiscoveryNode, Map<String, Object> registratorConfig) {
Address myLocalAddress = localDiscoveryNode.getPrivateAddress();
Object usePublicAddress = registratorConfig.get(CONFIG_PROP_PREFER_PUBLIC_ADDRESS);
if (usePublicAddress instanceof Boolean && Boolean.class.cast(usePublicAddress)) {
log.info("Registrator config property: {}:{} attempting to use it...",
CONFIG_PROP_PREFER_PUBLIC_ADDRESS,
usePublicAddress);
Address publicAddress = localDiscoveryNode.getPublicAddress();
myLocalAddress = (publicAddress != null) ? publicAddress : myLocalAddress;
}
return new Address(INET_UTILS_INSTANCE.findFirstNonLoopbackHostInfo().getIpAddress(), myLocalAddress.getPort());
}
示例2: determineMyLocalAddress
import com.hazelcast.spi.discovery.DiscoveryNode; //导入方法依赖的package包/类
@Override
@SneakyThrows
public Address determineMyLocalAddress(DiscoveryNode localDiscoveryNode, Map<String, Object> registratorConfig) {
Address myLocalAddress = localDiscoveryNode.getPrivateAddress();
Object usePublicAddress = (Object)registratorConfig.get(CONFIG_PROP_PREFER_PUBLIC_ADDRESS);
if (usePublicAddress != null && usePublicAddress instanceof Boolean && (Boolean)usePublicAddress) {
logger.info("Registrator config property: " + CONFIG_PROP_PREFER_PUBLIC_ADDRESS +":"+usePublicAddress + " attempting to use it...");
Address publicAddress = localDiscoveryNode.getPublicAddress();
if (publicAddress != null) {
myLocalAddress = publicAddress;
}
}
return new Address(InetUtils.getFirstNonLoopbackHostInfo().getIpAddress(), myLocalAddress.getPort());
}
示例3: determineMyLocalAddress
import com.hazelcast.spi.discovery.DiscoveryNode; //导入方法依赖的package包/类
@Override
public Address determineMyLocalAddress(DiscoveryNode localDiscoveryNode, Map<String, Object> registratorConfig) {
Address myLocalAddress = localDiscoveryNode.getPrivateAddress();
Object usePublicAddress = (Object)registratorConfig.get(CONFIG_PROP_PREFER_PUBLIC_ADDRESS);
if (usePublicAddress != null && usePublicAddress instanceof Boolean && (Boolean)usePublicAddress) {
logger.info("Registrator config property: " + CONFIG_PROP_PREFER_PUBLIC_ADDRESS +":"+usePublicAddress + " attempting to use it...");
Address publicAddress = localDiscoveryNode.getPublicAddress();
if (publicAddress != null) {
myLocalAddress = publicAddress;
}
}
return myLocalAddress;
}
开发者ID:bitsofinfo,项目名称:hazelcast-consul-discovery-spi,代码行数:17,代码来源:LocalDiscoveryNodeRegistrator.java