public static synchronized <T> T getInstance(Class<T> klass) {
    T instance = null;
    try {
      ServiceLoader<T> loader = ServiceLoader.load(klass);
      Iterator<T> it = loader.iterator();
      instance = it.next();
      if (it.hasNext()) {
        StringBuilder msg = new StringBuilder();
        msg.append("ServiceLoader provided more than one implementation for class: ").append(klass)
          .append(", using implementation: ").append(instance.getClass())
          .append(", other implementations: {");
        while (it.hasNext()) {
          msg.append(it.next()).append(" ");
        }
        msg.append("}");
        LOG.warn(msg.toString());
      }
    } catch (Exception e) {
      throw new RuntimeException(createExceptionString(klass), e);
    } catch (Error e) {
      throw new RuntimeException(createExceptionString(klass), e);
    }

    // If there was nothing returned and no exception then throw an exception.
    if (instance == null) {
      throw new RuntimeException(createExceptionString(klass));
    }
    return instance;
  }
This is a static only class don't let any instance be created.
hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/CompatibilityFactory.java