LPS-52106 Reference clearing and enqueuing are 2 different async operations, jdk only guarantees clearing happens before enqueuing. References that are cleared by the same gc are considered as a batch, there is no enqueuing order guarantee among all those references in the same batch. Therefore seeing the monitoring reference got enqueued, does not necessarily mean other cleared references in the same batch are all enqueued. Here we need a secondary batch, even though there is no order guarantee within a batch, we can count on that references from the first batch are guaranteed to be enqueued before any refenece from second batch is enqueued.
LPS-52106 Apply