[hibernate-commits] Hibernate SVN: r14126 - core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Fri Oct 19 18:27:20 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-10-19 18:27:20 -0400 (Fri, 19 Oct 2007)
New Revision: 14126
Modified:
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/MultiplexingCacheInstanceManager.java
Log:
Add some timestamp cache validation
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/MultiplexingCacheInstanceManager.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/MultiplexingCacheInstanceManager.java 2007-10-19 21:06:44 UTC (rev 14125)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/MultiplexingCacheInstanceManager.java 2007-10-19 22:27:20 UTC (rev 14126)
@@ -28,6 +28,7 @@
import org.hibernate.cache.CacheException;
import org.hibernate.cache.jbc2.CacheInstanceManager;
+import org.hibernate.cache.jbc2.util.CacheHelper;
import org.hibernate.cfg.Settings;
import org.hibernate.transaction.TransactionManagerLookup;
import org.hibernate.util.PropertiesHelper;
@@ -217,6 +218,12 @@
* {@inheritDoc}
*/
public Cache getQueryCacheInstance() {
+
+ if (jbcQueryCache != null && jbcTsCache == null) {
+ // This should only be possible if the caches are constructor injected
+ throw new CacheException("Timestamps cache must be configured if a query cache is used");
+ }
+
return jbcQueryCache;
}
@@ -224,7 +231,11 @@
* {@inheritDoc}
*/
public Cache getTimestampsCacheInstance() {
- return jbcTsCache;
+
+ if (jbcTsCache != null && CacheHelper.isClusteredInvalidation(jbcTsCache)) {
+ throw new CacheException("Clustered invalidation not supported for timestamps cache");
+ }
+ return jbcTsCache;
}
/**
@@ -325,12 +336,18 @@
}
if (jbcQueryCache != null) {
- configureTransactionManager(jbcQueryCache, tm, false);
- jbcQueryCache.start();
- }
+ configureTransactionManager(jbcQueryCache, tm, false);
+ jbcQueryCache.start();
+ // TODO: I considered validating the presence of the TS cache here,
+ // but decided to defer unti getQueryCacheInstance() in case the
+ // cache is never actually used
+ }
if (jbcTsCache != null) {
- configureTransactionManager(jbcTsCache, tm, true);
- jbcTsCache.start();
+ configureTransactionManager(jbcTsCache, tm, true);
+ jbcTsCache.start();
+ // TODO: I considered validating TS cache config here,
+ // but decided to defer unti getTimestampsCacheInstance() in case the
+ // cache is never actually used
}
}
else {
More information about the hibernate-commits
mailing list