use of org.apache.hadoop.util.ComparableVersion in project ozone by apache.
the class RpcClient method validateOmVersion.
static boolean validateOmVersion(String expectedVersion, List<ServiceInfo> serviceInfoList) {
if (expectedVersion == null || expectedVersion.isEmpty()) {
// Empty strings assumes client is fine with any OM version.
return true;
}
// At min one OM should be present.
boolean found = false;
for (ServiceInfo s : serviceInfoList) {
if (s.getNodeType() == HddsProtos.NodeType.OM) {
ComparableVersion comparableExpectedVersion = new ComparableVersion(expectedVersion);
ComparableVersion comparableOMVersion = new ComparableVersion(s.getProtobuf().getOMProtocolVersion());
if (comparableOMVersion.compareTo(comparableExpectedVersion) < 0) {
return false;
} else {
found = true;
}
}
}
return found;
}
Aggregations