Description
If a subclass of jdk.jfr.Event is loaded from the CDS archive, before JFR is initialized, this type of events does not function properly. Here's a skeletal example:
java .... -XX:FlightRecorderOptions=retransform=false ... MyTest
------
import jdk.jfr.Event;
import jdk.jfr.EventType;
class TestEvent extends Event { }
class MyTest {
public static void main(String args[]) throws Exception {
// TestEvent class is loaded *from CDS archive*
// before recording has started.
EventType type = EventType.getEventType(TestEvent.class);
// Start recording
Recording r = new Recording();
TestEvent testEvent = new TestEvent();
testEvent.commit();
r.stop()
// At this point, the TestEvent is properly stored in "r" because the
// testEvent.commit() method was not properly instrumented.
java .... -XX:FlightRecorderOptions=retransform=false ... MyTest
------
import jdk.jfr.Event;
import jdk.jfr.EventType;
class TestEvent extends Event { }
class MyTest {
public static void main(String args[]) throws Exception {
// TestEvent class is loaded *from CDS archive*
// before recording has started.
EventType type = EventType.getEventType(TestEvent.class);
// Start recording
Recording r = new Recording();
TestEvent testEvent = new TestEvent();
testEvent.commit();
r.stop()
// At this point, the TestEvent is properly stored in "r" because the
// testEvent.commit() method was not properly instrumented.