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


Java DiscoveryNode.getPublicAddress方法代码示例

本文整理汇总了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());
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:18,代码来源:CustomDiscoveryNodeRegistrator.java

示例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());
}
 
开发者ID:xm-online,项目名称:xm-ms-config,代码行数:18,代码来源:CustomDiscoveryNodeRegistrator.java

示例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


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