static void openCloseTableOutputFormat(int iter) throws IOException {
    LOG.info("Instantiating TableOutputFormat connection  " + iter);
    JobConf conf = new JobConf();
    conf.addResource(UTIL.getConfiguration());
    conf.set(TableOutputFormat.OUTPUT_TABLE, TABLE);
    TableMapReduceUtil.initTableMapJob(TABLE, FAMILY, TableMap.class, ImmutableBytesWritable.class,
      ImmutableBytesWritable.class, conf);
    TableOutputFormat tof = new TableOutputFormat();
    RecordWriter rw = tof.getRecordWriter(null, conf, TABLE, null);
    rw.close(null);
  }
Open and close a TableOutputFormat. The closing the RecordWriter should release HBase
Connection (ZK) resources, and will throw exception if they are exhausted.
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapred/TestTableOutputFormatConnectionExhaust.java