/** * Dumps heap to the specified path. * Logs where the heap dump will be written. * Logs a warning if there was a problem preventing the heap dump from being successfully created. * @param path Where to put the heap dump. */ public static void dumpHeap(final Path path) { LOG.info("writing heap dump to {}", path); final HotSpotDiagnosticMXBean bean = getBean(HotSpotDiagnosticMXBean.class); if (bean == null) { return; } try { bean.dumpHeap(path.toString(), true); } catch (IOException e) { LOG.warn("error writing heap dump", e); } }