HHH-10418 Synchronize on cache instead
This commit is contained in:
parent
46f885b80c
commit
18fa924f90
|
@ -144,7 +144,11 @@ public abstract class BaseTransactionalDataRegion
|
||||||
assert strategy == Strategy.VALIDATION;
|
assert strategy == Strategy.VALIDATION;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
// If two regions share the same name, they should use the same cache.
|
||||||
|
// Using same cache means they should use the same put validator.
|
||||||
|
// Besides, any cache interceptor initialization should only be done once.
|
||||||
|
// Synchronizes on the cache instance since it's shared between regions with same name.
|
||||||
|
synchronized (cache) {
|
||||||
PutFromLoadValidator found = findValidator(cache);
|
PutFromLoadValidator found = findValidator(cache);
|
||||||
validator = found != null ? found : new PutFromLoadValidator(cache, factory);
|
validator = found != null ? found : new PutFromLoadValidator(cache, factory);
|
||||||
strategy = Strategy.VALIDATION;
|
strategy = Strategy.VALIDATION;
|
||||||
|
|
Loading…
Reference in New Issue