Skip to content

Conversation

@olim7t
Copy link

@olim7t olim7t commented Feb 28, 2025

Tested on MacOS with Oracle versions 18.0.2.1, 19.0.2, 20.0.2 and 21.0.5 (arm64).

This only fixes issues that were detected by existing tests.

assertEquals(queueShallowSize + lockSize, meterIgnoring.measureDeep(queue));
// The queue contains one reference that isn't strong (so ignored), so it should measure the
// same as an empty queue.
assertEquals(meterIgnoring.measureDeep(new ReferenceQueue<>()), meterIgnoring.measureDeep(queue));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In earlier versions, ReferenceQueue uses a custom lock object internally. In newer versions, it uses a ReentrantLock and a Condition.
I think this achieves the same goal without the need to introduce complex conditional branches.

@olim7t
Copy link
Author

olim7t commented Mar 6, 2025

This overlaps with some of the work done in #71.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant