org.elasticsearch.Version.isCompatible()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.elasticsearch.Version.isCompatible()方法的一些代码示例,展示了Version.isCompatible()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.isCompatible()方法的具体详情如下:
包路径:org.elasticsearch.Version
类名称:Version
方法名:isCompatible

Version.isCompatible介绍

[英]Returns true iff both version are compatible. Otherwise false
[中]如果两个版本兼容,则返回true。否则false

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/** ensures that the joining node has a version that's compatible with a given version range */
static void ensureNodesCompatibility(Version joiningNodeVersion, Version minClusterNodeVersion, Version maxClusterNodeVersion) {
  assert minClusterNodeVersion.onOrBefore(maxClusterNodeVersion) : minClusterNodeVersion + " > " + maxClusterNodeVersion;
  if (joiningNodeVersion.isCompatible(maxClusterNodeVersion) == false) {
    throw new IllegalStateException("node version [" + joiningNodeVersion + "] is not supported. " +
      "The cluster contains nodes with version [" + maxClusterNodeVersion + "], which is incompatible.");
  }
  if (joiningNodeVersion.isCompatible(minClusterNodeVersion) == false) {
    throw new IllegalStateException("node version [" + joiningNodeVersion + "] is not supported." +
      "The cluster contains nodes with version [" + minClusterNodeVersion + "], which is incompatible.");
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

static void ensureVersionCompatibility(Version version, Version currentVersion, boolean isHandshake) {
  // for handshakes we are compatible with N-2 since otherwise we can't figure out our initial version
  // since we are compatible with N-1 and N+1 so we always send our minCompatVersion as the initial version in the
  // handshake. This looks odd but it's required to establish the connection correctly we check for real compatibility
  // once the connection is established
  final Version compatibilityVersion = isHandshake ? currentVersion.minimumCompatibilityVersion() : currentVersion;
  if (version.isCompatible(compatibilityVersion) == false) {
    final Version minCompatibilityVersion = isHandshake ? compatibilityVersion : compatibilityVersion.minimumCompatibilityVersion();
    String msg = "Received " + (isHandshake ? "handshake " : "") + "message from unsupported version: [";
    throw new IllegalStateException(msg + version + "] minimal compatible version is: [" + minCompatibilityVersion + "]");
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public void handleResponse(HandshakeResponse response) {
  if (isDone.compareAndSet(false, true)) {
    Version version = response.responseVersion;
    if (currentVersion.isCompatible(version) == false) {
      listener.onFailure(new IllegalStateException("Received message from unsupported version: [" + version
        + "] minimal compatible version is: [" + currentVersion.minimumCompatibilityVersion() + "]"));
    } else {
      listener.onResponse(version);
    }
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

} else if (response.version.isCompatible(localNode.getVersion()) == false) {
  throw new IllegalStateException("handshake failed, incompatible version [" + response.version + "] - " + node);

代码示例来源:origin: apache/servicemix-bundles

/** ensures that the joining node has a version that's compatible with a given version range */
static void ensureNodesCompatibility(Version joiningNodeVersion, Version minClusterNodeVersion, Version maxClusterNodeVersion) {
  assert minClusterNodeVersion.onOrBefore(maxClusterNodeVersion) : minClusterNodeVersion + " > " + maxClusterNodeVersion;
  if (joiningNodeVersion.isCompatible(maxClusterNodeVersion) == false) {
    throw new IllegalStateException("node version [" + joiningNodeVersion + "] is not supported. " +
      "The cluster contains nodes with version [" + maxClusterNodeVersion + "], which is incompatible.");
  }
  if (joiningNodeVersion.isCompatible(minClusterNodeVersion) == false) {
    throw new IllegalStateException("node version [" + joiningNodeVersion + "] is not supported." +
      "The cluster contains nodes with version [" + minClusterNodeVersion + "], which is incompatible.");
  }
}

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

/** returns the first future incompatible version */
public static Version incompatibleFutureVersion(Version version) {
  final Optional<Version> opt = ALL_VERSIONS.stream().filter(version::before).filter(v -> v.isCompatible(version) == false).findAny();
  assert opt.isPresent() : "no future incompatible version for " + version;
  return opt.get();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/** ensures that the joining node has a version that's compatible with a given version range */
static void ensureNodesCompatibility(Version joiningNodeVersion, Version minClusterNodeVersion, Version maxClusterNodeVersion) {
  assert minClusterNodeVersion.onOrBefore(maxClusterNodeVersion) : minClusterNodeVersion + " > " + maxClusterNodeVersion;
  if (joiningNodeVersion.isCompatible(maxClusterNodeVersion) == false) {
    throw new IllegalStateException("node version [" + joiningNodeVersion + "] is not supported. " +
      "The cluster contains nodes with version [" + maxClusterNodeVersion + "], which is incompatible.");
  }
  if (joiningNodeVersion.isCompatible(minClusterNodeVersion) == false) {
    throw new IllegalStateException("node version [" + joiningNodeVersion + "] is not supported." +
      "The cluster contains nodes with version [" + minClusterNodeVersion + "], which is incompatible.");
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

static void ensureVersionCompatibility(Version version, Version currentVersion, boolean isHandshake) {
  // for handshakes we are compatible with N-2 since otherwise we can't figure out our initial version
  // since we are compatible with N-1 and N+1 so we always send our minCompatVersion as the initial version in the
  // handshake. This looks odd but it's required to establish the connection correctly we check for real compatibility
  // once the connection is established
  final Version compatibilityVersion = isHandshake ? currentVersion.minimumCompatibilityVersion() : currentVersion;
  if (version.isCompatible(compatibilityVersion) == false) {
    final Version minCompatibilityVersion = isHandshake ? compatibilityVersion : compatibilityVersion.minimumCompatibilityVersion();
    String msg = "Received " + (isHandshake ? "handshake " : "") + "message from unsupported version: [";
    throw new IllegalStateException(msg + version + "] minimal compatible version is: [" + minCompatibilityVersion + "]");
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

} else {
  CountDown countDown = new CountDown(seeds.size());
  Predicate<DiscoveryNode> nodePredicate = (node) -> Version.CURRENT.isCompatible(node.getVersion())

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

} else {
  Version version = versionRef.get();
  if (getCurrentVersion().isCompatible(version) == false) {
    throw new IllegalStateException("Received message from unsupported version: [" + version
      + "] minimal compatible version is: [" + getCurrentVersion().minimumCompatibilityVersion() + "]");

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

} else {
  Version version = versionRef.get();
  if (getCurrentVersion().isCompatible(version) == false) {
    throw new IllegalStateException("Received message from unsupported version: [" + version
      + "] minimal compatible version is: [" + getCurrentVersion().minimumCompatibilityVersion() + "]");

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

} else if (response.version.isCompatible(localNode.getVersion()) == false) {
  throw new IllegalStateException("handshake failed, incompatible version [" + response.version + "] - " + node);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

} else if (response.version.isCompatible(localNode.getVersion()) == false) {
  throw new IllegalStateException("handshake failed, incompatible version [" + response.version + "] - " + node);

代码示例来源:origin: apache/servicemix-bundles

key -> boolSetting(key, false, Setting.Property.NodeScope, Setting.Property.Dynamic), REMOTE_CLUSTERS_SEEDS);
private static final Predicate<DiscoveryNode> DEFAULT_NODE_PREDICATE = (node) -> Version.CURRENT.isCompatible(node.getVersion())
    && (node.isMasterNode() == false  || node.isDataNode() || node.isIngestNode());

代码示例来源:origin: apache/servicemix-bundles

} else if (response.version.isCompatible(localNode.getVersion()) == false) {
  throw new IllegalStateException("handshake failed, incompatible version [" + response.version + "] - " + node);

相关文章