HHH-7871 Write cache should not using LOCAL flag
* Flags were not being applied in clustered environments because of the use of classloader aware cache which was not forwarding them.
This commit is contained in:
parent
1d5bf1608e
commit
b0efdb4d14
|
@ -39,7 +39,6 @@ import org.hibernate.cache.spi.CacheDataDescription;
|
|||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.infinispan.collection.CollectionRegionImpl;
|
||||
import org.hibernate.cache.infinispan.entity.EntityRegionImpl;
|
||||
import org.hibernate.cache.infinispan.impl.ClassLoaderAwareCache;
|
||||
import org.hibernate.cache.infinispan.query.QueryResultsRegionImpl;
|
||||
import org.hibernate.cache.infinispan.timestamp.TimestampTypeOverrides;
|
||||
import org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl;
|
||||
|
@ -563,10 +562,6 @@ public class InfinispanRegionFactory implements RegionFactory {
|
|||
}
|
||||
|
||||
protected AdvancedCache createCacheWrapper(AdvancedCache cache) {
|
||||
if (Caches.isClustered(cache))
|
||||
return new ClassLoaderAwareCache(cache,
|
||||
Thread.currentThread().getContextClassLoader());
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.transaction.Transaction;
|
|||
|
||||
import org.hibernate.cache.infinispan.util.Caches;
|
||||
import org.infinispan.AdvancedCache;
|
||||
import org.infinispan.context.Flag;
|
||||
import org.infinispan.util.logging.Log;
|
||||
import org.infinispan.util.logging.LogFactory;
|
||||
|
||||
|
@ -53,17 +52,13 @@ public class TransactionalAccessDelegate {
|
|||
private final AdvancedCache cache;
|
||||
private final BaseRegion region;
|
||||
private final PutFromLoadValidator putValidator;
|
||||
private final AdvancedCache writeCache;
|
||||
private final AdvancedCache putFromLoadCache;
|
||||
private final AdvancedCache<Object, Object> writeCache;
|
||||
|
||||
public TransactionalAccessDelegate(BaseRegion region, PutFromLoadValidator validator) {
|
||||
this.region = region;
|
||||
this.cache = region.getCache();
|
||||
this.putValidator = validator;
|
||||
this.writeCache = Caches.isInvalidationCache(cache) ?
|
||||
Caches.ignoreReturnValuesCache(cache, Flag.CACHE_MODE_LOCAL) :
|
||||
Caches.ignoreReturnValuesCache(cache);
|
||||
this.putFromLoadCache = Caches.ignoreReturnValuesCache(cache);
|
||||
this.writeCache = Caches.ignoreReturnValuesCache(cache);
|
||||
}
|
||||
|
||||
public Object get(Object key, long txTimestamp) throws CacheException {
|
||||
|
@ -100,7 +95,7 @@ public class TransactionalAccessDelegate {
|
|||
}
|
||||
|
||||
try {
|
||||
putFromLoadCache.putForExternalRead(key, value);
|
||||
writeCache.putForExternalRead(key, value);
|
||||
} finally {
|
||||
putValidator.releasePutFromLoadLock(key);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.infinispan.notifications.cachelistener.event.Event;
|
|||
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
|
||||
import org.hibernate.cache.infinispan.impl.ClassLoaderAwareCache;
|
||||
import org.hibernate.test.cache.infinispan.util.ClassLoaderAwareCache;
|
||||
import org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl;
|
||||
import org.hibernate.cache.spi.CacheDataDescription;
|
||||
import org.hibernate.cache.spi.Region;
|
||||
|
@ -167,7 +167,7 @@ public class TimestampsRegionImplTestCase extends AbstractGeneralDataRegionTestC
|
|||
SelectedClassnameClassLoader visible = new SelectedClassnameClassLoader(null, null, notFoundClasses, cl);
|
||||
Thread.currentThread().setContextClassLoader(visible);
|
||||
super.event(event);
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.hibernate.cache.infinispan.impl;
|
||||
package org.hibernate.test.cache.infinispan.util;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.ref.WeakReference;
|
Loading…
Reference in New Issue