public static void main(String []args) throws Exception {
    new GcTimeMonitor(20 * 1000, 500, 20,
          new GcTimeMonitor.GcTimeAlertHandler() {
            @Override
            public void alert(GcData gcData) {
              System.err.println(
                  "GcTimeMonitor alert. Current GC time percentage = " +
                  gcData.getGcTimePercentage() +
                  ", total run time = " + (gcData.getGcMonitorRunTimeMs() / 1000) + " sec" +
                  ", total GC time = " + (gcData.getAccumulatedGcTimeMs() / 1000) + " sec");
            }
          }).start();

    List<String> list = Lists.newArrayList();
    for (int i = 0; ; i++) {
      list.add("This is a long string to fill memory quickly " + i);
      if (i % 100000 == 0) {
        System.out.println("Added " + i + " strings");
        Thread.sleep(100);
      }
    }
  }
Simple 'main' to facilitate manual testing of the pause monitor.

This main function just leaks memory. Running this class will quickly
result in a "GC hell" and subsequent alerts from the GcTimeMonitor.
common/src/java/org/apache/hadoop/hive/common/GcTimeMonitor.java