mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 08:05:05 +00:00
fixed concurrency problem uncovered during JMH-based throughput testing (Act 3)
This commit is contained in:
parent
1b2aa85fa7
commit
2b65c73fb7
@ -181,10 +181,14 @@ private CacheableSqmInterpretation resolveCacheableSqmInterpretation(ExecutionCo
|
|||||||
// The other option would be to leverage `java.util.concurrent.locks.ReadWriteLock`
|
// The other option would be to leverage `java.util.concurrent.locks.ReadWriteLock`
|
||||||
// to protect access. However, synchronized is much simpler here. We will verify
|
// to protect access. However, synchronized is much simpler here. We will verify
|
||||||
// during throughput testing whether this is an issue and consider changes then
|
// during throughput testing whether this is an issue and consider changes then
|
||||||
if ( cacheableSqmInterpretation == null ) {
|
|
||||||
|
CacheableSqmInterpretation localCopy = cacheableSqmInterpretation;
|
||||||
|
|
||||||
|
if ( localCopy == null ) {
|
||||||
synchronized ( this ) {
|
synchronized ( this ) {
|
||||||
if ( cacheableSqmInterpretation == null ) {
|
localCopy = cacheableSqmInterpretation;
|
||||||
cacheableSqmInterpretation = buildCacheableSqmInterpretation(
|
if ( localCopy == null ) {
|
||||||
|
cacheableSqmInterpretation = localCopy = buildCacheableSqmInterpretation(
|
||||||
sqm,
|
sqm,
|
||||||
domainParameterXref,
|
domainParameterXref,
|
||||||
executionContext
|
executionContext
|
||||||
@ -193,7 +197,7 @@ private CacheableSqmInterpretation resolveCacheableSqmInterpretation(ExecutionCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cacheableSqmInterpretation;
|
return localCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CacheableSqmInterpretation buildCacheableSqmInterpretation(
|
private static CacheableSqmInterpretation buildCacheableSqmInterpretation(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user