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


Java DiscoveryNode.getAddress方法代码示例

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


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

示例1: testPrivateIp

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void testPrivateIp() throws InterruptedException {
    int nodes = randomInt(10);
    for (int i = 0; i < nodes; i++) {
        poorMansDNS.put(AmazonEC2Mock.PREFIX_PRIVATE_IP + (i+1), buildNewFakeTransportAddress());
    }
    Settings nodeSettings = Settings.builder()
            .put(DISCOVERY_EC2.HOST_TYPE_SETTING.getKey(), "private_ip")
            .build();
    List<DiscoveryNode> discoveryNodes = buildDynamicNodes(nodeSettings, nodes);
    assertThat(discoveryNodes, hasSize(nodes));
    // We check that we are using here expected address
    int node = 1;
    for (DiscoveryNode discoveryNode : discoveryNodes) {
        TransportAddress address = discoveryNode.getAddress();
        TransportAddress expected = poorMansDNS.get(AmazonEC2Mock.PREFIX_PRIVATE_IP + node++);
        assertEquals(address, expected);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:Ec2DiscoveryTests.java

示例2: testPublicIp

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void testPublicIp() throws InterruptedException {
    int nodes = randomInt(10);
    for (int i = 0; i < nodes; i++) {
        poorMansDNS.put(AmazonEC2Mock.PREFIX_PUBLIC_IP + (i+1), buildNewFakeTransportAddress());
    }
    Settings nodeSettings = Settings.builder()
            .put(DISCOVERY_EC2.HOST_TYPE_SETTING.getKey(), "public_ip")
            .build();
    List<DiscoveryNode> discoveryNodes = buildDynamicNodes(nodeSettings, nodes);
    assertThat(discoveryNodes, hasSize(nodes));
    // We check that we are using here expected address
    int node = 1;
    for (DiscoveryNode discoveryNode : discoveryNodes) {
        TransportAddress address = discoveryNode.getAddress();
        TransportAddress expected = poorMansDNS.get(AmazonEC2Mock.PREFIX_PUBLIC_IP + node++);
        assertEquals(address, expected);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:Ec2DiscoveryTests.java

示例3: testRejectingJoinWithSameAddressButDifferentId

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void testRejectingJoinWithSameAddressButDifferentId() throws InterruptedException, ExecutionException {
    addNodes(randomInt(5));
    ClusterState state = clusterService.state();
    final DiscoveryNode existing = randomFrom(StreamSupport.stream(state.nodes().spliterator(), false).collect(Collectors.toList()));
    final DiscoveryNode other_node = new DiscoveryNode("other_node", existing.getAddress(), emptyMap(), emptySet(), Version.CURRENT);

    ExecutionException e = expectThrows(ExecutionException.class, () -> joinNode(other_node));
    assertThat(e.getMessage(), containsString("found existing node"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:NodeJoinControllerTests.java

示例4: testRejectingJoinWithSameIdButDifferentNode

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void testRejectingJoinWithSameIdButDifferentNode() throws InterruptedException, ExecutionException {
    addNodes(randomInt(5));
    ClusterState state = clusterService.state();
    final DiscoveryNode existing = randomFrom(StreamSupport.stream(state.nodes().spliterator(), false).collect(Collectors.toList()));
    final DiscoveryNode other_node = new DiscoveryNode(
        randomBoolean() ? existing.getName() : "other_name",
        existing.getId(),
        randomBoolean() ? existing.getAddress() : buildNewFakeTransportAddress(),
        randomBoolean() ? existing.getAttributes() : Collections.singletonMap("attr", "other"),
        randomBoolean() ? existing.getRoles() : new HashSet<>(randomSubsetOf(Arrays.asList(DiscoveryNode.Role.values()))),
        randomBoolean() ? existing.getVersion() : VersionUtils.randomVersion(random()));

    ExecutionException e = expectThrows(ExecutionException.class, () -> joinNode(other_node));
    assertThat(e.getMessage(), containsString("found existing node"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:NodeJoinControllerTests.java

示例5: testRejectingRestartedNodeJoinsBeforeProcessingNodeLeft

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void testRejectingRestartedNodeJoinsBeforeProcessingNodeLeft() throws InterruptedException, ExecutionException {
    addNodes(randomInt(5));
    ClusterState state = clusterService.state();
    final DiscoveryNode existing = randomFrom(StreamSupport.stream(state.nodes().spliterator(), false).collect(Collectors.toList()));
    joinNode(existing); // OK

    final DiscoveryNode other_node = new DiscoveryNode(existing.getId(), existing.getAddress(), existing.getAttributes(),
        existing.getRoles(), Version.CURRENT);

    ExecutionException e = expectThrows(ExecutionException.class, () -> joinNode(other_node));
    assertThat(e.getMessage(), containsString("found existing node"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:NodeJoinControllerTests.java

示例6: testReadHostFromTag

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void testReadHostFromTag() throws InterruptedException, UnknownHostException {
    int nodes = randomIntBetween(5, 10);

    String[] addresses = new String[nodes];

    for (int node = 0; node < nodes; node++) {
        addresses[node] = "192.168.0." + (node + 1);
        poorMansDNS.put("node" + (node + 1), new TransportAddress(InetAddress.getByName(addresses[node]), 9300));
    }

    Settings nodeSettings = Settings.builder()
        .put(DISCOVERY_EC2.HOST_TYPE_SETTING.getKey(), "tag:foo")
        .build();

    List<List<Tag>> tagsList = new ArrayList<>();

    for (int node = 0; node < nodes; node++) {
        List<Tag> tags = new ArrayList<>();
        tags.add(new Tag("foo", "node" + (node + 1)));
        tagsList.add(tags);
    }

    logger.info("started [{}] instances", nodes);
    List<DiscoveryNode> discoveryNodes = buildDynamicNodes(nodeSettings, nodes, tagsList);
    assertThat(discoveryNodes, hasSize(nodes));
    for (DiscoveryNode discoveryNode : discoveryNodes) {
        TransportAddress address = discoveryNode.getAddress();
        TransportAddress expected = poorMansDNS.get(discoveryNode.getName());
        assertEquals(address, expected);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:32,代码来源:Ec2DiscoveryTests.java

示例7: SendRequestTransportException

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) {
    super(node == null ? null : node.getName(), node == null ? null : node.getAddress(), action, cause);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:SendRequestTransportException.java

示例8: ConnectTransportException

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public ConnectTransportException(DiscoveryNode node, String msg, String action, Throwable cause) {
    super(node == null ? null : node.getName(), node == null ? null : node.getAddress(), action, msg, cause);
    this.node = node;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ConnectTransportException.java

示例9: ReceiveTimeoutTransportException

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public ReceiveTimeoutTransportException(DiscoveryNode node, String action, String msg) {
    super(node.getName(), node.getAddress(), action, msg, null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:ReceiveTimeoutTransportException.java

示例10: cloneNode

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
/**
 * creates an object clone of node, so it will be a different object instance
 */
private DiscoveryNode cloneNode(DiscoveryNode node) {
    return new DiscoveryNode(node.getName(), node.getId(), node.getEphemeralId(), node.getHostName(), node.getHostAddress(),
        node.getAddress(), node.getAttributes(), node.getRoles(), node.getVersion());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:NodeJoinControllerTests.java


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