HHH-10418 Only create validator if none associated with cache
This commit is contained in:
parent
ed33e5d7a9
commit
37475d9c1f
|
@ -17,11 +17,7 @@ import org.hibernate.cache.infinispan.access.TombstoneCallInterceptor;
|
|||
import org.hibernate.cache.infinispan.access.TxInvalidationCacheAccessDelegate;
|
||||
import org.hibernate.cache.infinispan.access.UnorderedDistributionInterceptor;
|
||||
import org.hibernate.cache.infinispan.access.VersionedCallInterceptor;
|
||||
import org.hibernate.cache.infinispan.util.Caches;
|
||||
import org.hibernate.cache.infinispan.util.FutureUpdate;
|
||||
import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
|
||||
import org.hibernate.cache.infinispan.util.Tombstone;
|
||||
import org.hibernate.cache.infinispan.util.VersionedEntry;
|
||||
import org.hibernate.cache.infinispan.util.*;
|
||||
import org.hibernate.cache.spi.CacheDataDescription;
|
||||
import org.hibernate.cache.spi.CacheKeysFactory;
|
||||
import org.hibernate.cache.spi.TransactionalDataRegion;
|
||||
|
@ -148,8 +144,16 @@ public abstract class BaseTransactionalDataRegion
|
|||
assert strategy == Strategy.VALIDATION;
|
||||
return;
|
||||
}
|
||||
validator = new PutFromLoadValidator(cache, factory);
|
||||
strategy = Strategy.VALIDATION;
|
||||
synchronized (this) {
|
||||
PutFromLoadValidator found = findValidator(cache);
|
||||
validator = found != null ? found : new PutFromLoadValidator(cache, factory);
|
||||
strategy = Strategy.VALIDATION;
|
||||
}
|
||||
}
|
||||
|
||||
private PutFromLoadValidator findValidator(AdvancedCache cache) {
|
||||
CacheCommandInitializer cmdInit = cache.getComponentRegistry().getComponent(CacheCommandInitializer.class);
|
||||
return cmdInit.findPutFromLoadValidator(cache.getName());
|
||||
}
|
||||
|
||||
protected void prepareForVersionedEntries() {
|
||||
|
|
|
@ -48,6 +48,10 @@ public class CacheCommandInitializer implements ModuleCommandInitializer {
|
|||
putFromLoadValidators.put(cacheName, putFromLoadValidator);
|
||||
}
|
||||
|
||||
public PutFromLoadValidator findPutFromLoadValidator(String cacheName) {
|
||||
return putFromLoadValidators.get(cacheName);
|
||||
}
|
||||
|
||||
public PutFromLoadValidator removePutFromLoadValidator(String cacheName) {
|
||||
return putFromLoadValidators.remove(cacheName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue