Fix a subtle double-checked locking issue

This commit is contained in:
Nathan Xu 2020-02-29 22:25:49 -05:00 committed by Steve Ebersole
parent df0aa1eb2e
commit cf46163958
1 changed files with 1 additions and 1 deletions

View File

@ -753,7 +753,7 @@ public abstract class AbstractCollectionPersister
} }
// lazily initialize instance field via 'double-checked locking' // lazily initialize instance field via 'double-checked locking'
// see https://en.wikipedia.org/wiki/Double-checked_locking // see https://en.wikipedia.org/wiki/Double-checked_locking on why 'volatile' and local copy is used
protected CollectionLoader getStandardCollectionLoader() { protected CollectionLoader getStandardCollectionLoader() {
CollectionLoader localCopy = standardCollectionLoader; CollectionLoader localCopy = standardCollectionLoader;
if ( localCopy == null ) { if ( localCopy == null ) {