8231922: Could not find field with name revokedClass
Reviewed-by: egahlin
This commit is contained in:
parent
173dae8bc6
commit
c2a05a128d
@ -101,8 +101,9 @@ public class TestBiasedLockRevocationEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve all biased lock revocation events related to the provided lock class, sorted by start time
|
// 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()
|
return Events.fromRecording(recording).stream()
|
||||||
|
.filter(e -> e.getEventType().getName().equals(eventTypeName))
|
||||||
.filter(e -> ((RecordedClass)e.getValue(fieldName)).getName().equals(lockClass.getName()))
|
.filter(e -> ((RecordedClass)e.getValue(fieldName)).getName().equals(lockClass.getName()))
|
||||||
.sorted(Comparator.comparing(RecordedEvent::getStartTime))
|
.sorted(Comparator.comparing(RecordedEvent::getStartTime))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -119,7 +120,7 @@ public class TestBiasedLockRevocationEvents {
|
|||||||
Thread biasBreaker = triggerRevocation(1, MyLock.class);
|
Thread biasBreaker = triggerRevocation(1, MyLock.class);
|
||||||
|
|
||||||
recording.stop();
|
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);
|
Asserts.assertEQ(events.size(), 1);
|
||||||
|
|
||||||
RecordedEvent event = events.get(0);
|
RecordedEvent event = events.get(0);
|
||||||
@ -143,7 +144,7 @@ public class TestBiasedLockRevocationEvents {
|
|||||||
Thread biasBreaker = triggerRevocation(BULK_REVOKE_THRESHOLD, MyLock.class);
|
Thread biasBreaker = triggerRevocation(BULK_REVOKE_THRESHOLD, MyLock.class);
|
||||||
|
|
||||||
recording.stop();
|
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);
|
Asserts.assertEQ(events.size(), 1);
|
||||||
|
|
||||||
RecordedEvent event = events.get(0);
|
RecordedEvent event = events.get(0);
|
||||||
@ -169,7 +170,7 @@ public class TestBiasedLockRevocationEvents {
|
|||||||
Thread.holdsLock(l);
|
Thread.holdsLock(l);
|
||||||
|
|
||||||
recording.stop();
|
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);
|
Asserts.assertEQ(events.size(), 1);
|
||||||
|
|
||||||
RecordedEvent event = events.get(0);
|
RecordedEvent event = events.get(0);
|
||||||
@ -211,7 +212,7 @@ public class TestBiasedLockRevocationEvents {
|
|||||||
touch(l);
|
touch(l);
|
||||||
|
|
||||||
recording.stop();
|
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);
|
Asserts.assertEQ(events.size(), 1);
|
||||||
|
|
||||||
RecordedEvent event = events.get(0);
|
RecordedEvent event = events.get(0);
|
||||||
@ -237,7 +238,7 @@ public class TestBiasedLockRevocationEvents {
|
|||||||
Thread biasBreaker1 = triggerRevocation(BULK_REVOKE_THRESHOLD, MyLock.class);
|
Thread biasBreaker1 = triggerRevocation(BULK_REVOKE_THRESHOLD, MyLock.class);
|
||||||
|
|
||||||
recording.stop();
|
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);
|
Asserts.assertEQ(events.size(), 2);
|
||||||
|
|
||||||
// The rebias event should occur before the noRebias one
|
// The rebias event should occur before the noRebias one
|
||||||
|
Loading…
x
Reference in New Issue
Block a user