HHH-10418 Synchronize on cache instead

This commit is contained in:
Galder Zamarreño 2017-12-07 16:23:23 +01:00 committed by Gail Badner
parent 37475d9c1f
commit 8f80faa23e
1 changed files with 5 additions and 1 deletions

View File

@ -144,7 +144,11 @@ public abstract class BaseTransactionalDataRegion
assert strategy == Strategy.VALIDATION;
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);
validator = found != null ? found : new PutFromLoadValidator(cache, factory);
strategy = Strategy.VALIDATION;