Skip to content

Commit

Permalink
HHH-10418 Synchronize on cache instead
Browse files Browse the repository at this point in the history
  • Loading branch information
galderz authored and gbadner committed Jan 5, 2018
1 parent 37475d9 commit 8f80faa
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -144,7 +144,11 @@ protected void prepareForValidation() {
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;
Expand Down

0 comments on commit 8f80faa

Please sign in to comment.