< prev index next >

test/jdk/jdk/jfr/jcmd/TestJcmdDump.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -25,10 +25,11 @@
 
 package jdk.jfr.jcmd;
 
 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;
 
 import jdk.jfr.Event;

@@ -51,11 +52,11 @@
     static class StoppedEvent extends Event {
     }
     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 {
 
         // Create a stopped recording in the repository to complicate things

@@ -68,22 +69,27 @@
         // The implementation of JFR.dump touch code that can't be executed using the
         // Java API. It is therefore important to try all combinations. The
         // 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);
                     r1.setToDisk(disk);
                     // To complicate things, only enable OldObjectSample for one recording
                     r1.enable(EventNames.OldObjectSample).withoutStackTrace();
                     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);
                     // Expect path to GC roots
                     jfrDump(null, name, disk, rootCount -> rootCount == 0);
< prev index next >