private static long getMaxHeapSize(MemoryMXBean bean) {
    long maxHeapSize = bean.getHeapMemoryUsage().getMax();
    /*
     * According to the javadoc, getMax() can return -1. In this case
     * default to 200MB. This will probably never actually happen.
     */
    if(maxHeapSize == -1) {
      LOG.warn("MemoryMXBean.getHeapMemoryUsage().getMax() returned -1, " +
          "defaulting maxHeapSize to 200MB");
      return 200L * 1024L * 1024L;
    }
    return maxHeapSize;
  }
Constructor expects a LogHelper object in addition to the max percent
of heap memory which can be consumed before a MapJoinMemoryExhaustionException
is thrown.
ql/src/java/org/apache/hadoop/hive/ql/exec/mapjoin/MapJoinMemoryExhaustionHandler.java