public static final WriterFactory getWriterFactory(Configuration conf, CacheConfig cacheConf) {
    int version = getFormatVersion(conf);
    switch (version) {
      case 2:
        throw new IllegalArgumentException("This should never happen. "
          + "Did you change hfile.format.version to read v2? This version of the software writes v3"
          + " hfiles only (but it can read v2 files without having to update hfile.format.version "
          + "in hbase-site.xml)");
      case 3:
        return new HFile.WriterFactory(conf, cacheConf);
      default:
        throw new IllegalArgumentException(
          "Cannot create writer for HFile " + "format version " + version);
    }
  }
Returns the factory to be used to create {@link HFile} writers
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java