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


Java Address.getPort方法代码示例

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


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

示例1: determineMyLocalAddress

import com.hazelcast.nio.Address; //导入方法依赖的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.nio.Address; //导入方法依赖的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: start

import com.hazelcast.nio.Address; //导入方法依赖的package包/类
@Override
public void start() {
    Address address = discoveryNode.getPrivateAddress();
    String host = address.getHost();
    int port = address.getPort();
    execute(() -> someRestService.register(applicationScope, host, port));
}
 
开发者ID:noctarius,项目名称:hazelcast-discovery-spi-demonstration,代码行数:8,代码来源:SomeRestServiceDiscoveryStrategy.java

示例4: destroy

import com.hazelcast.nio.Address; //导入方法依赖的package包/类
@Override
public void destroy() {
    Address address = discoveryNode.getPrivateAddress();
    String host = address.getHost();
    int port = address.getPort();
    execute(() -> someRestService.unregister(applicationScope, host, port));
}
 
开发者ID:noctarius,项目名称:hazelcast-discovery-spi-demonstration,代码行数:8,代码来源:SomeRestServiceDiscoveryStrategy.java

示例5: getBindAddress

import com.hazelcast.nio.Address; //导入方法依赖的package包/类
@Override
public InetSocketAddress getBindAddress() {
    Address addr = this.swarmDiscoveryUtil.getMyAddress();
    return new InetSocketAddress(addr.getHost(), addr.getPort());
}
 
开发者ID:bitsofinfo,项目名称:hazelcast-docker-swarm-discovery-spi,代码行数:6,代码来源:SwarmMemberAddressProvider.java

示例6: getPublicAddress

import com.hazelcast.nio.Address; //导入方法依赖的package包/类
@Override
public InetSocketAddress getPublicAddress() {
    Address addr = this.swarmDiscoveryUtil.getMyAddress();
    return new InetSocketAddress(addr.getHost(), addr.getPort());
}
 
开发者ID:bitsofinfo,项目名称:hazelcast-docker-swarm-discovery-spi,代码行数:6,代码来源:SwarmMemberAddressProvider.java

示例7: SingleNodeFaultSupplier

import com.hazelcast.nio.Address; //导入方法依赖的package包/类
SingleNodeFaultSupplier(Address failOnAddress, RuntimeException e) {
    this.e = e;
    this.host = failOnAddress.getHost();
    this.port = failOnAddress.getPort();
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:6,代码来源:CancellationTest.java


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