當前位置: 首頁>>代碼示例>>Java>>正文


Java DiscoveryNode.getVersion方法代碼示例

本文整理匯總了Java中org.elasticsearch.cluster.node.DiscoveryNode.getVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java DiscoveryNode.getVersion方法的具體用法?Java DiscoveryNode.getVersion怎麽用?Java DiscoveryNode.getVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.cluster.node.DiscoveryNode的用法示例。


在下文中一共展示了DiscoveryNode.getVersion方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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.getVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。