private void removeFromFinishTimesMap(Map<Long, Integer> finishTimesMap, long finishTime) {
    if (finishTimesMap != null && !finishTimesMap.isEmpty()) {
      Integer count = finishTimesMap.get(finishTime);
      if (count != null) {
        if (count == 1) {
          finishTimesMap.remove(finishTime);
        } else {
          finishTimesMap.put(finishTime, count - 1);
        }
      }
    }
  }
The class that runs the Dr. Elephant daemon
app/com/linkedin/drelephant/ElephantRunner.java