[hibernate-commits] Hibernate SVN: r17659 - core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Oct 8 16:59:57 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-10-08 16:59:56 -0400 (Thu, 08 Oct 2009)
New Revision: 17659

Modified:
   core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/OptimisticTransactionalAccessDelegate.java
   core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/TransactionalAccessDelegate.java
Log:
[HHH-4484] When JBoss Cache is configured for INVALIDATION don't send cluster message on entity insert

Modified: core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/OptimisticTransactionalAccessDelegate.java
===================================================================
--- core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/OptimisticTransactionalAccessDelegate.java	2009-10-08 19:43:00 UTC (rev 17658)
+++ core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/OptimisticTransactionalAccessDelegate.java	2009-10-08 20:59:56 UTC (rev 17659)
@@ -102,6 +102,9 @@
         region.ensureRegionRootExists();
 
         Option opt = getDataVersionOption(version, null);
+        if (this.invalidation) {
+        	opt.setCacheModeLocal(true);
+        }
         CacheHelper.put(cache, regionFqn, key, value, opt);
         return true;
     }

Modified: core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/TransactionalAccessDelegate.java
===================================================================
--- core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/TransactionalAccessDelegate.java	2009-10-08 19:43:00 UTC (rev 17658)
+++ core/trunk/cache-jbosscache/src/main/java/org/hibernate/cache/jbc/access/TransactionalAccessDelegate.java	2009-10-08 20:59:56 UTC (rev 17659)
@@ -33,6 +33,7 @@
 import org.hibernate.cache.jbc.util.CacheHelper;
 import org.jboss.cache.Cache;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Option;
 
 /**
  * Defines the strategy for transactional access to entity or collection data in
@@ -49,6 +50,7 @@
         
     protected final Cache cache;
     protected final Fqn regionFqn;
+    protected final boolean invalidation;
     protected final BasicRegionAdapter region;
     protected final PutFromLoadValidator putValidator;
 
@@ -57,6 +59,7 @@
         this.cache = adapter.getCacheInstance();
         this.regionFqn = adapter.getRegionFqn();
         this.putValidator = validator;
+        this.invalidation = CacheHelper.isClusteredInvalidation(this.cache);
     }
 
     public Object get(Object key, long txTimestamp) throws CacheException {
@@ -125,8 +128,14 @@
             return false;
        
         region.ensureRegionRootExists();
-
-        CacheHelper.put(cache, regionFqn, key, value);
+        if (invalidation) {
+        	Option opt = new Option();
+        	opt.setCacheModeLocal(true);
+        	CacheHelper.put(cache, regionFqn, key, value, opt);
+        }
+        else {
+        	CacheHelper.put(cache, regionFqn, key, value);
+        }
         return true;
     }
 



More information about the hibernate-commits mailing list