mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8203028: Simplify reference processing in light of JDK-8175797
Removed special handling of Reference.next Reviewed-by: tschatzl, sjohanss, mchung
This commit is contained in:
parent
ace1b8a4c9
commit
6c20824cda
9 changed files with 197 additions and 210 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -66,6 +66,7 @@ public class ReferenceQueue<T> {
|
|||
return false;
|
||||
}
|
||||
assert queue == this;
|
||||
// Self-loop end, so if a FinalReference it remains inactive.
|
||||
r.next = (head == null) ? r : head;
|
||||
head = r;
|
||||
queueLength++;
|
||||
|
@ -90,7 +91,10 @@ public class ReferenceQueue<T> {
|
|||
// poll(). Volatiles ensure ordering.
|
||||
@SuppressWarnings("unchecked")
|
||||
Reference<? extends T> rn = r.next;
|
||||
// Handle self-looped next as end of list designator.
|
||||
head = (rn == r) ? null : rn;
|
||||
// Self-loop next rather than setting to null, so if a
|
||||
// FinalReference it remains inactive.
|
||||
r.next = r;
|
||||
queueLength--;
|
||||
if (r instanceof FinalReference) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue