public Map<String, SampleNode> sampleTest(final Sampler sampler, final String filename) throws InterruptedException, IOException { sampler.registerJmx(); sampler.start(); MonitorTest.main(new String[]{}); final File serializedFile = File.createTempFile(filename, ".ssdump3"); Map<String, SampleNode> collected = sampler.getStackCollectionsAndReset(); Converter.saveLabeledDumps(serializedFile, collected); LOG.debug("Dumped to file {}", serializedFile); sampler.stop(); Map<String, SampleNode> loadedDumps = Converter.loadLabeledDumps(serializedFile); for (Map.Entry<String, SampleNode> entry : loadedDumps.entrySet()) { LOG.debug("Loaded {}", entry.getKey()); } return collected; } }