< prev index next >

src/jdk.management.jfr/share/classes/jdk/management/jfr/RecordingInfo.java

Print this page

        

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

@@ -49,11 +49,11 @@
     private final long id;
     private final String name;
     private final String state;
     private final boolean dumpOnExit;
     private final long size;
-    private final boolean disk;
+    private final boolean toDisk;
     private final long maxAge;
     private final long maxSize;
     private final long startTime;
     private final long stopTime;
     private final String destination;

@@ -65,11 +65,11 @@
         id = recording.getId();
         name = recording.getName();
         state = recording.getState().toString();
         dumpOnExit = recording.getDumpOnExit();
         size = recording.getSize();
-        disk = recording.isToDisk();
+        toDisk = recording.isToDisk();
 
         Duration d = recording.getMaxAge();
         if (d == null) {
             maxAge = 0;
         } else {

@@ -85,16 +85,21 @@
         durationInSeconds = duration == null ? 0 : duration.getSeconds();
         settings = recording.getSettings();
     }
 
     private RecordingInfo(CompositeData cd) {
-        id = (int) cd.get("id");
+        id = (long) cd.get("id");
         name = (String) cd.get("name");
         state = (String) cd.get("state");
         dumpOnExit = (boolean) cd.get("dumpOnExit");
         size = (long) cd.get("size");
-        disk = (boolean) cd.get("disk");
+        if(cd.containsKey("toDisk")){
+            toDisk = (boolean) cd.get("toDisk");
+        } else {
+            // Before JDK-8219904 was fixed, the element name was disk, so for compatibility
+            toDisk = (boolean) cd.get("disk");
+        }
         maxAge = (Long) cd.get("maxAge");
         maxSize = (Long) cd.get("maxSize");
         startTime = (Long) cd.get("startTime");
         stopTime = (Long) cd.get("stopTime");
         destination = (String) cd.get("destination");

@@ -288,11 +293,11 @@
      * full, {@code false} otherwise.
      *
      * @return {@code true} if recording is to disk, {@code false} otherwise
      */
     public boolean isToDisk() {
-        return disk;
+        return toDisk;
     }
 
     /**
      * Returns the desired duration, measured in seconds, of the recording
      * associated with this {@link RecordingInfo}, or {code 0} if no duration

@@ -340,11 +345,11 @@
      * <tr>
      * <th scope="row">size</th>
      * <td>{@code Long}</td>
      * </tr>
      * <tr>
-     * <th scope="row">disk</th>
+     * <th scope="row">toDisk</th>
      * <td>{@code Boolean}</td>
      * </tr>
      * <tr>
      * <th scope="row">maxAge</th>
      * <td>{@code Long}</td>
< prev index next >