本文整理匯總了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"));
}
示例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();
}
};
}
示例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());
}