< prev index next >
test/jdk/jdk/jfr/jmx/TestGetRecordings.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -33,18 +33,24 @@
/**
* @test
* @key jfr
* @requires vm.hasJFR
* @library /test/lib /test/jdk
- * @run main/othervm jdk.jfr.jmx.TestGetRecordings
+ * @run main/othervm -Djdk.attach.allowAttachSelf=true -Dcom.sun.management.jmxremote jdk.jfr.jmx.TestGetRecordings
*/
public class TestGetRecordings {
public static void main(String[] args) throws Throwable {
FlightRecorderMXBean bean =JmxHelper.getFlighteRecorderMXBean();
List<RecordingInfo> preCreateRecordings = bean.getRecordings();
long recId = bean.newRecording();
JmxHelper.verifyNotExists(recId, preCreateRecordings);
bean.closeRecording(recId);
JmxHelper.verifyNotExists(recId, bean.getRecordings());
+
+ long selfPID = JmxHelper.getPID();
+ FlightRecorderMXBean remoteBean = JmxHelper.getFlighteRecorderMXBean(selfPID);
+ long remoteRecId = remoteBean.newRecording();
+ remoteBean.getRecordings();
+ remoteBean.closeRecording(remoteRecId);
}
}
< prev index next >