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