[jboss-dev-forums] [Design of Clustering on JBoss] - Re: JBCLUSTER-206 - Extract HB/JBC integration layer from EJ
bstansberry@jboss.com
do-not-reply at jboss.com
Thu Aug 7 12:41:40 EDT 2008
Looked through your changes. I like the CacheProperties class. :)
Only thing I see is we need to override localPutsOnly if the we are caching timestamps. Following patch does that:
| Index: /home/bes/dev/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java
| ===================================================================
| --- /home/bes/dev/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java (revision 76762)
| +++ /home/bes/dev/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/JBCCache.java (working copy)
| @@ -33,6 +33,7 @@
| import org.hibernate.cache.Cache;
|
| import org.hibernate.cache.CacheException;
|
| import org.hibernate.cache.StandardQueryCache;
|
| +import org.hibernate.cache.UpdateTimestampsCache;
|
| import org.jboss.cache.Fqn;
|
| import org.jboss.cache.config.Option;
|
| import org.jboss.cache.lock.TimeoutException;
|
| @@ -57,6 +58,7 @@
| private final Fqn regionFqn;
|
| private final TransactionManager transactionManager;
|
| private boolean queryCacheLocalWritesOnly;
|
| + private boolean localPutsOnly;
|
|
|
| private final CacheProperties cacheProperties;
|
|
|
| @@ -95,6 +97,8 @@
| {
|
| log.debug("TreeCache is not configured for region based marshalling");
|
| }
|
| +
|
| + this.localPutsOnly = this.cacheProperties.isLocalPutsOnly() && (regionName.contains(UpdateTimestampsCache.class.getName()) == false);
|
| }
|
|
|
| public Object get(Object key) throws CacheException {
|
| @@ -135,7 +139,7 @@
| public void put(Object key, Object value) throws CacheException {
|
| Transaction tx = suspend();
|
| try {
|
| - if (queryCacheLocalWritesOnly || cacheProperties.isLocalPutsOnly()) {
|
| + if (queryCacheLocalWritesOnly || localPutsOnly) {
|
| Option option = new Option();
|
| option.setCacheModeLocal(true);
|
| // Overloaded method isn't available, so have to use InvocationContext
|
| Index: /home/bes/dev/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java
| ===================================================================
| --- /home/bes/dev/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java (revision 76762)
| +++ /home/bes/dev/cluster/hibernate-jbc-cacheprovider/trunk/src/main/java/org/jboss/hibernate/jbc/cacheprovider/OptimisticJBCCache.java (working copy)
| @@ -31,6 +31,7 @@
| import org.hibernate.cache.OptimisticCache;
| import org.hibernate.cache.OptimisticCacheSource;
| import org.hibernate.cache.StandardQueryCache;
| +import org.hibernate.cache.UpdateTimestampsCache;
| import org.jboss.cache.Fqn;
| import org.jboss.cache.optimistic.DataVersion;
| import org.jboss.cache.config.Option;
| @@ -59,6 +60,7 @@
| private final Fqn regionFqn;
| private OptimisticCacheSource source;
| private boolean queryCacheLocalWritesOnly;
| + private boolean localPutsOnly;
|
| private final CacheProperties cacheProperties;
|
| @@ -95,6 +97,8 @@
| {
| log.debug("TreeCache is not configured for region based marshalling");
| }
| +
| + this.localPutsOnly = this.cacheProperties.isLocalPutsOnly() && (regionName.contains(UpdateTimestampsCache.class.getName()) == false);
| }
|
|
| @@ -128,7 +132,7 @@
| Option option = new Option();
| option.setFailSilently( true );
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| - option.setCacheModeLocal(queryCacheLocalWritesOnly);
| + option.setCacheModeLocal(queryCacheLocalWritesOnly || localPutsOnly);
| cache.remove( new Fqn( regionFqn, key ), "ITEM", option );
|
| option = new Option();
| @@ -137,7 +141,7 @@
| ? new DataVersionAdapter( currentVersion, currentVersion, source.getVersionComparator(), source.toString() )
| : NonLockingDataVersion.INSTANCE;
| option.setDataVersion( dv );
| - option.setCacheModeLocal(queryCacheLocalWritesOnly);
| + option.setCacheModeLocal(queryCacheLocalWritesOnly || localPutsOnly);
| cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
| }
| catch (Exception e) {
| @@ -188,7 +192,7 @@
| Option option = new Option();
| option.setFailSilently( true );
| option.setDataVersion( NonLockingDataVersion.INSTANCE );
| - option.setCacheModeLocal(queryCacheLocalWritesOnly);
| + option.setCacheModeLocal(queryCacheLocalWritesOnly || localPutsOnly);
| cache.put( new Fqn( regionFqn, key ), ITEM, value, option );
| }
| catch (TimeoutException te) {
I can check that in if it won't step on you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169353#4169353
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169353
More information about the jboss-dev-forums
mailing list