8231922: Could not find field with name revokedClass
authormgronlun
Mon, 11 Nov 2019 11:25:15 +0100
changeset 59005 01d47d511f5f
parent 59002 586415e8abcb
child 59006 d3f1cb09b704
8231922: Could not find field with name revokedClass Reviewed-by: egahlin
test/jdk/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java
--- a/test/jdk/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java	Mon Nov 11 10:41:03 2019 +0100
+++ b/test/jdk/jdk/jfr/event/runtime/TestBiasedLockRevocationEvents.java	Mon Nov 11 11:25:15 2019 +0100
@@ -101,8 +101,9 @@
     }
 
     // Retrieve all biased lock revocation events related to the provided lock class, sorted by start time
-    static List<RecordedEvent> getRevocationEvents(Recording recording, String fieldName, Class<?> lockClass) throws Throwable {
+    static List<RecordedEvent> getRevocationEvents(Recording recording, String eventTypeName, String fieldName, Class<?> lockClass) throws Throwable {
         return Events.fromRecording(recording).stream()
+                .filter(e -> e.getEventType().getName().equals(eventTypeName))
                 .filter(e -> ((RecordedClass)e.getValue(fieldName)).getName().equals(lockClass.getName()))
                 .sorted(Comparator.comparing(RecordedEvent::getStartTime))
                 .collect(Collectors.toList());
@@ -119,7 +120,7 @@
         Thread biasBreaker = triggerRevocation(1, MyLock.class);
 
         recording.stop();
-        List<RecordedEvent> events = getRevocationEvents(recording, "lockClass", MyLock.class);
+        List<RecordedEvent> events = getRevocationEvents(recording, EventNames.BiasedLockRevocation, "lockClass", MyLock.class);
         Asserts.assertEQ(events.size(), 1);
 
         RecordedEvent event = events.get(0);
@@ -143,7 +144,7 @@
         Thread biasBreaker = triggerRevocation(BULK_REVOKE_THRESHOLD, MyLock.class);
 
         recording.stop();
-        List<RecordedEvent> events = getRevocationEvents(recording, "revokedClass", MyLock.class);
+        List<RecordedEvent> events = getRevocationEvents(recording, EventNames.BiasedLockClassRevocation, "revokedClass", MyLock.class);
         Asserts.assertEQ(events.size(), 1);
 
         RecordedEvent event = events.get(0);
@@ -169,7 +170,7 @@
         Thread.holdsLock(l);
 
         recording.stop();
-        List<RecordedEvent> events = getRevocationEvents(recording, "lockClass", MyLock.class);
+        List<RecordedEvent> events = getRevocationEvents(recording, EventNames.BiasedLockSelfRevocation, "lockClass", MyLock.class);
         Asserts.assertEQ(events.size(), 1);
 
         RecordedEvent event = events.get(0);
@@ -211,7 +212,7 @@
         touch(l);
 
         recording.stop();
-        List<RecordedEvent> events = getRevocationEvents(recording, "lockClass", MyLock.class);
+        List<RecordedEvent> events = getRevocationEvents(recording, EventNames.BiasedLockRevocation, "lockClass", MyLock.class);
         Asserts.assertEQ(events.size(), 1);
 
         RecordedEvent event = events.get(0);
@@ -237,7 +238,7 @@
         Thread biasBreaker1 = triggerRevocation(BULK_REVOKE_THRESHOLD, MyLock.class);
 
         recording.stop();
-        List<RecordedEvent> events = getRevocationEvents(recording, "revokedClass", MyLock.class);
+        List<RecordedEvent> events = getRevocationEvents(recording, EventNames.BiasedLockClassRevocation, "revokedClass", MyLock.class);
         Asserts.assertEQ(events.size(), 2);
 
         // The rebias event should occur before the noRebias one