private int countWAL(Path log) throws IOException {
    int count = 0;
    try (WALStreamReader in = wals.createStreamReader(fs, log)) {
      while (in.next() != null) {
        count++;
      }
    }
    return count;
  }
@param leaveOpen index to leave un-closed. -1 to close all.
@return the writer that's still open, or null if all were closed.
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java