--- old/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java 2019-03-15 17:43:19.378214184 +0900 +++ new/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java 2019-03-15 17:43:19.138216342 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,6 +57,8 @@ public final class PlatformRecording implements AutoCloseable { + public static final String REASON_DUMPED_BY_USER = "Dumped by user"; + private final PlatformRecorder recorder; private final long id; // Recording settings @@ -160,7 +162,7 @@ this.stopTime = Instant.now(); newState = getState(); } - WriteableUserPath dest = getDestination(); + WriteableUserPath dest = reason.equals(REASON_DUMPED_BY_USER) ? null : getDestination(); if (dest != null) { try { --- old/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java 2019-03-15 17:43:19.866209797 +0900 +++ new/src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java 2019-03-15 17:43:19.618212027 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,7 +199,7 @@ } PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording); - return pr.newSnapshotClone("Dumped by user", pathToGcRoots); + return pr.newSnapshotClone(PlatformRecording.REASON_DUMPED_BY_USER, pathToGcRoots); } } --- old/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java 2019-03-15 17:43:20.360205356 +0900 +++ new/test/jdk/jdk/jfr/jcmd/TestJcmdDump.java 2019-03-15 17:43:20.106207640 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.io.File; import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; @@ -53,7 +54,7 @@ static class RunningEvent extends Event { } - private static final String[] names = { null, "r1" }; + private static final String[] names = { null, "r1", "r3" }; private static final boolean booleanValues[] = { true, false }; public static void main(String[] args) throws Exception { @@ -70,7 +71,7 @@ // implementation is non-trivial and depends on the combination for (String name : names) { for (boolean disk : booleanValues) { - try (Recording r1 = new Recording(); Recording r2 = new Recording()) { + try (Recording r1 = new Recording(); Recording r2 = new Recording(); Recording r3 = new Recording()) { System.out.println(); System.out.println(); System.out.println("Starting recordings with disk=" + disk); @@ -80,8 +81,13 @@ r1.setName("r1"); r2.setToDisk(disk); r2.setName("r2"); + r3.enable(EventNames.OldObjectSample).withoutStackTrace(); + r3.setDestination(Paths.get("test.jfr")); + r3.setToDisk(disk); + r3.setName("r3"); r1.start(); r2.start(); + r3.start(); // Expect no path to GC roots jfrDump(Boolean.FALSE, name, disk, rootCount -> rootCount == 0);