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:
Galder Zamarreño 2012-12-18 09:17:15 +01:00
parent 461a8db773
commit c64b8bc4ae
4 changed files with 6 additions and 16 deletions

View File

@ -36,7 +36,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;
@ -550,10 +549,6 @@ public class InfinispanRegionFactory implements RegionFactory {
}
protected AdvancedCache createCacheWrapper(AdvancedCache cache) {
if (Caches.isClustered(cache))
return new ClassLoaderAwareCache(cache,
Thread.currentThread().getContextClassLoader());
return cache;
}

View File

@ -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);
}

View File

@ -40,7 +40,7 @@ import org.infinispan.notifications.cachelistener.annotation.CacheEntryVisited;
import org.infinispan.notifications.cachelistener.event.Event;
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;

View File

@ -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;