Search in sources :

Example 1 with ComparableVersion

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;
}
Also used : ServiceInfo(org.apache.hadoop.ozone.om.helpers.ServiceInfo) ComparableVersion(org.apache.hadoop.util.ComparableVersion)

Aggregations

ServiceInfo (org.apache.hadoop.ozone.om.helpers.ServiceInfo)1 ComparableVersion (org.apache.hadoop.util.ComparableVersion)1