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


Java DiscoveryNode.getName方法代码示例

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


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

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

示例2: wrapLivenessResponseHandler

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
private <T extends TransportResponse> TransportResponseHandler wrapLivenessResponseHandler(TransportResponseHandler<T> handler,
                                                                                           DiscoveryNode node,
                                                                                           ClusterName clusterName) {
    return new TransportResponseHandler<T>() {
        @Override
        public T newInstance() {
            return handler.newInstance();
        }

        @Override
        @SuppressWarnings("unchecked")
        public void handleResponse(T response) {
            LivenessResponse livenessResponse = new LivenessResponse(clusterName,
                    new DiscoveryNode(node.getName(), node.getId(), node.getEphemeralId(), "liveness-hostname" + node.getId(),
                            "liveness-hostaddress" + node.getId(),
                            livenessAddress, node.getAttributes(), node.getRoles(),
                            node.getVersion()));
            handler.handleResponse((T)livenessResponse);
        }

        @Override
        public void handleException(TransportException exp) {
            handler.handleException(exp);
        }

        @Override
        public String executor() {
            return handler.executor();
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:32,代码来源:TransportClientNodesServiceTests.java

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

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

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

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