diff -r 49c3e91c424f -r 2ae4cd9d809d src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java Mon May 21 11:33:59 2018 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecorder.java Mon May 21 14:46:12 2018 +0200 @@ -245,7 +245,7 @@ RequestEngine.doChunkBegin(); } - synchronized void stop(PlatformRecording recording) { + synchronized void stop(PlatformRecording recording, WriteableUserPath alternativePath) { RecordingState state = recording.getState(); if (Utils.isAfter(state, RecordingState.RUNNING)) { @@ -278,7 +278,7 @@ } } else { // last memory - dumpMemoryToDestination(recording); + dumpMemoryToDestination(recording, alternativePath); } jvm.endRecording_(); disableEvents(); @@ -314,8 +314,8 @@ } } - private void dumpMemoryToDestination(PlatformRecording recording) { - WriteableUserPath dest = recording.getDestination(); + private void dumpMemoryToDestination(PlatformRecording recording, WriteableUserPath alternativePath) { + WriteableUserPath dest = alternativePath != null ? alternativePath : recording.getDestination(); if (dest != null) { MetadataRepository.getInstance().setOutput(dest.getText()); recording.clearDestination();