8309688: Data race on java.io.ClassCache$CacheRef.strongReferent
Reviewed-by: rriggs, shade
This commit is contained in:
parent
81bfd78901
commit
5c705166da
@ -39,6 +39,11 @@ abstract class ClassCache<T> {
|
|||||||
|
|
||||||
private static class CacheRef<T> extends SoftReference<T> {
|
private static class CacheRef<T> extends SoftReference<T> {
|
||||||
private final Class<?> type;
|
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;
|
private T strongReferent;
|
||||||
|
|
||||||
CacheRef(T referent, ReferenceQueue<T> queue, Class<?> type) {
|
CacheRef(T referent, ReferenceQueue<T> queue, Class<?> type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user