mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8309688: Data race on java.io.ClassCache$CacheRef.strongReferent
Reviewed-by: rriggs, shade
This commit is contained in:
parent
81bfd78901
commit
5c705166da
1 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,11 @@ abstract class ClassCache<T> {
|
|||
|
||||
private static class CacheRef<T> extends SoftReference<T> {
|
||||
private final Class<?> type;
|
||||
// This field is deliberately accessed without sychronization. ClassValue
|
||||
// provides synchronization when CacheRef is published. However, when
|
||||
// a thread reads this field, while another thread is clearing the field, it
|
||||
// would formally constitute a data race. But that data race is benign, and
|
||||
// fixing it could introduce noticeable performance penalty, see JDK-8309688.
|
||||
private T strongReferent;
|
||||
|
||||
CacheRef(T referent, ReferenceQueue<T> queue, Class<?> type) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue