Class VersionInfoUtil

java.lang.Object
org.apache.hadoop.hbase.client.VersionInfoUtil

@Private public final class VersionInfoUtil extends Object
Class to help with parsing the version info.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    We intend to use the local version for service call shortcut(s), so we use an interface compatible with a typical service call, with 2 args, return type, and an exception type.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final ThreadLocal<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static int
    buildVersionNumber(int major, int minor, int patch)
    Pack the full number version in a int.
    static <T1, T2, R, E extends Throwable>
    R
     
    static boolean
    currentClientHasMinimumVersion(int major, int minor)
     
    static org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo
    Returns the versionInfo extracted from the current RpcCallContext
    private static String[]
    getVersionComponents(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo versionInfo)
    Returns the version components Examples: "1.4.3" returns [1, 4, 3], "4.5.6-SNAPSHOT" returns [4, 5, 6, "SNAPSHOT"]
    static int
    getVersionNumber(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo versionInfo)
    Pack the full number version in a int.
    static boolean
    hasMinimumVersion(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo versionInfo, int major, int minor)
     
    static String
    versionNumberToString(int version)
    Returns the passed-in version int as a version String (e.g.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NonCallVersion

      private static final ThreadLocal<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo> NonCallVersion
  • Constructor Details

  • Method Details

    • currentClientHasMinimumVersion

      public static boolean currentClientHasMinimumVersion(int major, int minor)
    • hasMinimumVersion

      public static boolean hasMinimumVersion(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo versionInfo, int major, int minor)
    • callWithVersion

      public static <T1, T2, R, E extends Throwable> R callWithVersion(VersionInfoUtil.ServiceCallFunction<T1,T2,R,E> f, T1 t1, T2 t2) throws E
      Throws:
      E extends Throwable
    • getCurrentClientVersionInfo

      public static org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo getCurrentClientVersionInfo()
      Returns the versionInfo extracted from the current RpcCallContext
    • versionNumberToString

      public static String versionNumberToString(int version)
      Returns the passed-in version int as a version String (e.g. 0x0103004 is 1.3.4)
    • getVersionNumber

      public static int getVersionNumber(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo versionInfo)
      Pack the full number version in a int. by shifting each component by 8bit, except the dot release which has 12bit. Examples: (1.3.4 is 0x0103004, 2.1.0 is 0x0201000)
      Parameters:
      versionInfo - the VersionInfo object to pack
      Returns:
      the version number as int. (e.g. 0x0103004 is 1.3.4)
    • buildVersionNumber

      private static int buildVersionNumber(int major, int minor, int patch)
      Pack the full number version in a int. by shifting each component by 8bit, except the dot release which has 12bit. Examples: (1.3.4 is 0x0103004, 2.1.0 is 0x0201000)
      Parameters:
      major - version major number
      minor - version minor number
      patch - version patch number
      Returns:
      the version number as int. (e.g. 0x0103004 is 1.3.4)
    • getVersionComponents

      private static String[] getVersionComponents(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo versionInfo)
      Returns the version components Examples: "1.4.3" returns [1, 4, 3], "4.5.6-SNAPSHOT" returns [4, 5, 6, "SNAPSHOT"]
      Returns:
      the components of the version string