Hibernate SVN: r14265 - in core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2: entity and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-24 11:01:02 -0500 (Mon, 24 Dec 2007)
New Revision: 14265
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java
Log:
Fix the evictRemoveAll tests for the optimistic case
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-12-24 15:19:46 UTC (rev 14264)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-12-24 16:01:02 UTC (rev 14265)
@@ -433,7 +433,7 @@
Node regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -442,7 +442,7 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -476,7 +476,7 @@
regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingInvalidation()) {
@@ -500,26 +500,27 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
if (isUsingInvalidation()) {
- // JBC seems broken: see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=121408
- // FIXME replace with the following when JBCACHE-1199 and JBCACHE-1200 are done:
- //assertFalse(regionRoot.isValid());
- checkNodeIsEmpty(regionRoot);
+ // Region root should have 1 child -- the one we added above
+ assertEquals(1, getValidChildrenCount(regionRoot));
}
else {
// Same assertion, just different assertion msg
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
}
assertTrue(regionRoot.isResident());
assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
- assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
+ assertEquals("remote is correct", (isUsingInvalidation() ? VALUE1 : null), remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
- private void checkNodeIsEmpty(Node node) {
- assertEquals(node.getFqn() + " should not have keys", 0, node.getKeys().size());
+ private int getValidChildrenCount(Node node) {
+ int result = 0;
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- checkNodeIsEmpty((Node) it.next());
+ if (((Node) it.next()).isValid()) {
+ result++;
+ }
}
+ return result;
}
private void rollback() {
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24 15:19:46 UTC (rev 14264)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24 16:01:02 UTC (rev 14265)
@@ -55,15 +55,5 @@
assertTrue("Using Optimistic locking", isUsingOptimisticLocking());
assertTrue("Synchronous mode", isSynchronous());
}
-
- // Known failures
-
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java 2007-12-24 15:19:46 UTC (rev 14264)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java 2007-12-24 16:01:02 UTC (rev 14265)
@@ -54,15 +54,5 @@
assertTrue("Using Optimistic locking", isUsingOptimisticLocking());
assertTrue("Synchronous mode", isSynchronous());
}
-
- // Known failures
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
-
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-12-24 15:19:46 UTC (rev 14264)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-12-24 16:01:02 UTC (rev 14265)
@@ -24,6 +24,7 @@
package org.hibernate.test.cache.jbc2.entity;
import java.util.Iterator;
+import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -640,7 +641,7 @@
Node regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -649,7 +650,7 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingOptimisticLocking()) {
@@ -685,7 +686,7 @@
regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
if (isUsingInvalidation()) {
@@ -709,26 +710,27 @@
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
if (isUsingInvalidation()) {
- // JBC seems broken: see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=121408
- // FIXME replace with the following when JBCACHE-1199 and JBCACHE-1200 are done:
- //assertFalse(regionRoot.isValid());
- checkNodeIsEmpty(regionRoot);
+ // Region root should have 1 child -- the one we added above
+ assertEquals(1, getValidChildrenCount(regionRoot));
}
else {
// Same assertion, just different assertion msg
- assertEquals(0, regionRoot.getChildrenNames().size());
+ assertEquals(0, getValidChildrenCount(regionRoot));
}
assertTrue(regionRoot.isResident());
assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
- assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
+ assertEquals("remote is correct", (isUsingInvalidation() ? VALUE1 : null), remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
- private void checkNodeIsEmpty(Node node) {
- assertEquals(node.getFqn() + " should not have keys", 0, node.getKeys().size());
+ private int getValidChildrenCount(Node node) {
+ int result = 0;
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- checkNodeIsEmpty((Node) it.next());
+ if (((Node) it.next()).isValid()) {
+ result++;
+ }
}
+ return result;
}
protected void rollback() {
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24 15:19:46 UTC (rev 14264)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticInvalidatedTransactionalTestCase.java 2007-12-24 16:01:02 UTC (rev 14265)
@@ -55,13 +55,4 @@
assertTrue("Synchronous mode", isSynchronous());
}
- // Known failures
-
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java 2007-12-24 15:19:46 UTC (rev 14264)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticReadOnlyTestCase.java 2007-12-24 16:01:02 UTC (rev 14265)
@@ -54,15 +54,5 @@
assertTrue("Using Optimistic locking", isUsingOptimisticLocking());
assertTrue("Synchronous mode", isSynchronous());
}
-
- // Known failures
- public void testEvictAllFailureExpected() {
- super.testEvictAll();
- }
-
- public void testRemoveAllFailureExpected() {
- super.testRemoveAll();
- }
-
}
16 years, 11 months
Hibernate SVN: r14264 - core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-24 10:19:46 -0500 (Mon, 24 Dec 2007)
New Revision: 14264
Modified:
core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jbc2-configs.xml
Log:
Add minTimeToLiveSeconds configs
Modified: core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jbc2-configs.xml
===================================================================
(Binary files differ)
16 years, 11 months
Hibernate SVN: r14263 - in core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2: access and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:59:07 -0500 (Sun, 23 Dec 2007)
New Revision: 14263
Modified:
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/BasicRegionAdapter.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/OptimisticTransactionalAccessDelegate.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/TransactionalAccessDelegate.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/OptimisticTransactionalAccess.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/TransactionalAccess.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/OptimisticTransactionalAccess.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/TransactionalAccess.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/timestamp/TimestampsRegionImpl.java
Log:
Update handling of deletion of the region root node
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/BasicRegionAdapter.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/BasicRegionAdapter.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/BasicRegionAdapter.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -40,11 +40,16 @@
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeCreated;
+import org.jboss.cache.notifications.annotation.NodeRemoved;
import org.jboss.cache.notifications.event.NodeCreatedEvent;
+import org.jboss.cache.notifications.event.NodeRemovedEvent;
import org.jboss.cache.optimistic.DataVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.Region;
+import org.hibernate.cache.jbc2.builder.JndiMultiplexingCacheInstanceManager;
import org.hibernate.cache.jbc2.util.CacheHelper;
import org.hibernate.cache.jbc2.util.NonLockingDataVersion;
@@ -56,16 +61,20 @@
*/
@CacheListener
public abstract class BasicRegionAdapter implements Region {
+
+
public static final String ITEM = CacheHelper.ITEM;
protected final Cache jbcCache;
protected final String regionName;
protected final Fqn regionFqn;
+ protected Node regionRoot;
protected final boolean optimistic;
-
protected final TransactionManager transactionManager;
+ protected final Logger log;
+ protected final Object regionRootMutex = new Object();
- protected SetResidentListener listener;
+ protected RegionRootListener listener;
public BasicRegionAdapter(Cache jbcCache, String regionName, String regionPrefix) {
this.jbcCache = jbcCache;
@@ -73,6 +82,7 @@
this.regionName = regionName;
this.regionFqn = createRegionFqn(regionName, regionPrefix);
optimistic = jbcCache.getConfiguration().getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC;
+ log = LoggerFactory.getLogger(getClass());
activateLocalClusterNode();
}
@@ -97,33 +107,50 @@
// and then need to re-add it. In that case, the fact
// that it is resident will not replicate, so use a listener
// to set it as resident
- if (CacheHelper.isClusteredReplication(cfg.getCacheMode())) {
- listener = new SetResidentListener();
+ if (CacheHelper.isClusteredReplication(cfg.getCacheMode())
+ || CacheHelper.isClusteredInvalidation(cfg.getCacheMode())) {
+ listener = new RegionRootListener();
jbcCache.addCacheListener(listener);
}
- // Make sure the root node for the region exists and
- // has a DataVersion that never complains
- Node regionRoot = jbcCache.getRoot().getChild( regionFqn );
- if (regionRoot == null) {
- // Establish the region root node with a non-locking data version
- DataVersion version = optimistic ? NonLockingDataVersion.INSTANCE : null;
- regionRoot = CacheHelper.addNode(jbcCache, regionFqn, true, true, version);
- }
- else if (optimistic && regionRoot instanceof NodeSPI) {
- // FIXME Hacky workaround to JBCACHE-1202
- if ( !( ( ( NodeSPI ) regionRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
- ((NodeSPI) regionRoot).setVersion(NonLockingDataVersion.INSTANCE);
- }
- }
- // Never evict this node
- regionRoot.setResident(true);
+ establishRegionRootNode();
}
catch (Exception e) {
throw new CacheException(e.getMessage(), e);
}
}
+ private void establishRegionRootNode()
+ {
+ synchronized (regionRootMutex) {
+ if (regionRoot != null && regionRoot.isValid())
+ return;
+ // Don't hold a transactional lock for this
+ Transaction tx = suspend();
+ try {
+ // Make sure the root node for the region exists and
+ // has a DataVersion that never complains
+ regionRoot = jbcCache.getRoot().getChild( regionFqn );
+ if (regionRoot == null) {
+ // Establish the region root node with a non-locking data version
+ DataVersion version = optimistic ? NonLockingDataVersion.INSTANCE : null;
+ regionRoot = CacheHelper.addNode(jbcCache, regionFqn, true, true, version);
+ }
+ else if (optimistic && regionRoot instanceof NodeSPI) {
+ // FIXME Hacky workaround to JBCACHE-1202
+ if ( !( ( ( NodeSPI ) regionRoot ).getVersion() instanceof NonLockingDataVersion ) ) {
+ ((NodeSPI) regionRoot).setVersion(NonLockingDataVersion.INSTANCE);
+ }
+ }
+ // Never evict this node
+ regionRoot.setResident(true);
+ }
+ finally {
+ resume(tx);
+ }
+ }
+ }
+
public String getName() {
return regionName;
}
@@ -135,12 +162,29 @@
public Fqn getRegionFqn() {
return regionFqn;
}
+
+ /**
+ * If the cache is configured for optimistic locking, checks for the
+ * validity of the root cache node for this region,
+ * creating a new one if it does not exist or is invalid. Suspends any
+ * transaction while doing this to ensure no transactional locks are held
+ * on the region root.
+ *
+ * This is only needed for optimistic locking, as with optimistic the
+ * region root node has a special version that must be established.
+ *
+ * TODO remove this once JBCACHE-1250 is resolved.
+ */
+ public void ensureRegionRootExists() {
+ if (optimistic && (regionRoot == null || !regionRoot.isValid()))
+ establishRegionRootNode();
+ }
public void destroy() throws CacheException {
try {
// NOTE : this is being used from the process of shutting down a
// SessionFactory. Specific things to consider:
- // (1) this clearing of the region should not propogate to
+ // (1) this clearing of the region should not propagate to
// other nodes on the cluster (if any); this is the
// cache-mode-local option bit...
// (2) really just trying a best effort to cleanup after
@@ -321,11 +365,12 @@
}
@CacheListener
- public class SetResidentListener {
+ public class RegionRootListener {
@NodeCreated
public void nodeCreated(NodeCreatedEvent event) {
if (!event.isPre() && event.getFqn().equals(getRegionFqn())) {
+ log.debug("Node created for " + getRegionFqn());
Node regionRoot = jbcCache.getRoot().getChild(getRegionFqn());
regionRoot.setResident(true);
}
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/OptimisticTransactionalAccessDelegate.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/OptimisticTransactionalAccessDelegate.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/OptimisticTransactionalAccessDelegate.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -27,11 +27,11 @@
import org.hibernate.cache.CacheException;
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.access.EntityRegionAccessStrategy;
+import org.hibernate.cache.jbc2.BasicRegionAdapter;
+import org.hibernate.cache.jbc2.TransactionalDataRegionAdapter;
import org.hibernate.cache.jbc2.util.CacheHelper;
import org.hibernate.cache.jbc2.util.DataVersionAdapter;
import org.hibernate.cache.jbc2.util.NonLockingDataVersion;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
import org.jboss.cache.config.Option;
import org.jboss.cache.optimistic.DataVersion;
@@ -51,9 +51,9 @@
protected final CacheDataDescription dataDescription;
- public OptimisticTransactionalAccessDelegate(Cache cache, Fqn regionFqn, CacheDataDescription dataDescription) {
- super(cache, regionFqn);
- this.dataDescription = dataDescription;
+ public OptimisticTransactionalAccessDelegate(TransactionalDataRegionAdapter region) {
+ super(region);
+ this.dataDescription = region.getCacheDataDescription();
}
/**
@@ -63,6 +63,8 @@
*/
@Override
public void evict(Object key) throws CacheException {
+
+ region.ensureRegionRootExists();
Option opt = NonLockingDataVersion.getInvocationOption();
CacheHelper.remove(cache, regionFqn, key, opt);
@@ -76,6 +78,18 @@
public void evictAll() throws CacheException {
evictOrRemoveAll();
+ }
+
+ /**
+ * Overrides the {@link TransactionalAccessDelegate#get(Object, long) superclass}
+ * by {@link BasicRegionAdapter#ensureRegionRootExists() ensuring the root
+ * node for the region exists} before making the call.
+ */
+ @Override
+ public Object get(Object key, long txTimestamp) throws CacheException
+ {
+ region.ensureRegionRootExists();
+ return super.get(key, txTimestamp);
}
/**
@@ -85,6 +99,8 @@
*/
@Override
public boolean insert(Object key, Object value, Object version) throws CacheException {
+
+ region.ensureRegionRootExists();
Option opt = getDataVersionOption(version, null);
CacheHelper.put(cache, regionFqn, key, value, opt);
@@ -94,6 +110,8 @@
@Override
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
throws CacheException {
+
+ region.ensureRegionRootExists();
// We ignore minimalPutOverride. JBossCache putForExternalRead is
// already about as minimal as we can get; it will promptly return
@@ -104,6 +122,8 @@
@Override
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
+
+ region.ensureRegionRootExists();
Option opt = getDataVersionOption(version, version);
return CacheHelper.putForExternalRead(cache, regionFqn, key, value, opt);
@@ -111,6 +131,8 @@
@Override
public void remove(Object key) throws CacheException {
+
+ region.ensureRegionRootExists();
Option opt = NonLockingDataVersion.getInvocationOption();
CacheHelper.remove(cache, regionFqn, key, opt);
@@ -125,6 +147,8 @@
@Override
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
throws CacheException {
+
+ region.ensureRegionRootExists();
Option opt = getDataVersionOption(currentVersion, previousVersion);
CacheHelper.put(cache, regionFqn, key, value, opt);
@@ -132,6 +156,7 @@
}
private Option getDataVersionOption(Object currentVersion, Object previousVersion) {
+
DataVersion dv = (dataDescription != null && dataDescription.isVersioned()) ? new DataVersionAdapter(
currentVersion, previousVersion, dataDescription.getVersionComparator(), dataDescription.toString())
: NonLockingDataVersion.INSTANCE;
@@ -141,6 +166,7 @@
}
private void evictOrRemoveAll() {
+
Option opt = NonLockingDataVersion.getInvocationOption();
CacheHelper.removeAll(cache, regionFqn, opt);
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/TransactionalAccessDelegate.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/TransactionalAccessDelegate.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/access/TransactionalAccessDelegate.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -27,6 +27,7 @@
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
import org.hibernate.cache.access.EntityRegionAccessStrategy;
import org.hibernate.cache.access.SoftLock;
+import org.hibernate.cache.jbc2.BasicRegionAdapter;
import org.hibernate.cache.jbc2.util.CacheHelper;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
@@ -46,10 +47,12 @@
protected final Cache cache;
protected final Fqn regionFqn;
+ protected final BasicRegionAdapter region;
- public TransactionalAccessDelegate(Cache cache, Fqn regionFqn) {
- this.cache = cache;
- this.regionFqn = regionFqn;
+ public TransactionalAccessDelegate(BasicRegionAdapter adapter) {
+ this.region = adapter;
+ this.cache = adapter.getCacheInstance();
+ this.regionFqn = adapter.getRegionFqn();
}
public Object get(Object key, long txTimestamp) throws CacheException {
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/OptimisticTransactionalAccess.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/OptimisticTransactionalAccess.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/OptimisticTransactionalAccess.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -42,8 +42,7 @@
public OptimisticTransactionalAccess(CollectionRegionImpl region) {
// We use a different delegate than the non-optimistic superclass default
- super(region, new OptimisticTransactionalAccessDelegate(region.getCacheInstance(), region.getRegionFqn(),
- region.getCacheDataDescription()));
+ super(region, new OptimisticTransactionalAccessDelegate(region));
}
}
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/TransactionalAccess.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/TransactionalAccess.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/TransactionalAccess.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -52,7 +52,7 @@
* @param region the region to which this provides access
*/
public TransactionalAccess(CollectionRegionImpl region) {
- this(region, new TransactionalAccessDelegate(region.getCacheInstance(), region.getRegionFqn()));
+ this(region, new TransactionalAccessDelegate(region));
}
/**
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/OptimisticTransactionalAccess.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/OptimisticTransactionalAccess.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/OptimisticTransactionalAccess.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -41,7 +41,6 @@
* @param region The region\ to which this is providing access
*/
public OptimisticTransactionalAccess(EntityRegionImpl region) {
- super(region, new OptimisticTransactionalAccessDelegate(region.getCacheInstance(), region.getRegionFqn(),
- region.getCacheDataDescription()));
+ super(region, new OptimisticTransactionalAccessDelegate(region));
}
}
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/TransactionalAccess.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/TransactionalAccess.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/TransactionalAccess.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -46,7 +46,7 @@
private final TransactionalAccessDelegate delegate;
public TransactionalAccess(EntityRegionImpl region) {
- this(region, new TransactionalAccessDelegate(region.getCacheInstance(), region.getRegionFqn()));
+ this(region, new TransactionalAccessDelegate(region));
}
protected TransactionalAccess(EntityRegionImpl region, TransactionalAccessDelegate delegate) {
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/query/QueryResultsRegionImpl.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -75,6 +75,9 @@
}
public void evict(Object key) throws CacheException {
+
+ ensureRegionRootExists();
+
Option opt = getNonLockingDataVersionOption(false);
if (localOnly)
opt.setCacheModeLocal(true);
@@ -91,6 +94,8 @@
}
public Object get(Object key) throws CacheException {
+
+ ensureRegionRootExists();
// Don't hold the JBC node lock throughout the tx, as that
// prevents updates
@@ -102,6 +107,8 @@
}
public void put(Object key, Object value) throws CacheException {
+
+ ensureRegionRootExists();
// Here we don't want to suspend the tx. If we do:
// 1) We might be caching query results that reflect uncommitted
@@ -110,9 +117,9 @@
// 2) No tx == immediate replication. More overhead, plus we
// spread issue #1 above around the cluster
- // Add a zero (or quite low) timeout option so we don't block
+ // Add a zero (or quite low) timeout option so we don't block.
// Ignore any TimeoutException. Basically we forego caching the
- // query result in order to avoid blocking for concurrent reads.
+ // query result in order to avoid blocking.
// Reads are done with suspended tx, so they should not hold the
// lock for long. Not caching the query result is OK, since
// any subsequent read will just see the old result with its
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/timestamp/TimestampsRegionImpl.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/timestamp/TimestampsRegionImpl.java 2007-12-23 14:55:36 UTC (rev 14262)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/timestamp/TimestampsRegionImpl.java 2007-12-23 14:59:07 UTC (rev 14263)
@@ -85,6 +85,9 @@
}
public void evict(Object key) throws CacheException {
+
+ ensureRegionRootExists();
+
// TODO Is this a valid operation on a timestamps cache?
Option opt = getNonLockingDataVersionOption(true);
CacheHelper.removeNode(getCacheInstance(), getRegionFqn(), key, opt);
@@ -102,6 +105,9 @@
Object value = localCache.get(key);
if (value == null) {
+
+ ensureRegionRootExists();
+
value = suspendAndGet(key, null, false);
if (value != null)
localCache.put(key, value);
@@ -110,6 +116,8 @@
}
public void put(Object key, Object value) throws CacheException {
+
+ ensureRegionRootExists();
// Don't hold the JBC node lock throughout the tx, as that
// prevents reads and other updates
16 years, 11 months
Hibernate SVN: r14262 - core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:55:36 -0500 (Sun, 23 Dec 2007)
New Revision: 14262
Removed:
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactory.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactoryImpl.java
Modified:
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JndiMultiplexingCacheInstanceManager.java
core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/MultiplexingCacheInstanceManager.java
Log:
Convert from JBossCacheFactory prototype to the real JBC CacheManager
Deleted: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactory.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactory.java 2007-12-23 14:53:06 UTC (rev 14261)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactory.java 2007-12-23 14:55:36 UTC (rev 14262)
@@ -1,81 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.cache.jbc2.builder;
-
-import java.util.Set;
-
-import org.jboss.cache.Cache;
-
-/**
- * Factory and registry for JBoss Cache instances configured using
- * named configurations.
- *
- * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
- * @version $Revision: 1 $
- */
-public interface JBossCacheFactory {
-
- /**
- * Gets all the names of all the configurations of which this object
- * is aware.
- *
- * @return
- */
- Set getConfigurationNames();
-
- /**
- * Get a cache configured according to the given configuration name.
- * <p>
- * The caller is free to invoke the {@link Cache#create()} and
- * {@link Cache#start()} lifecycle methods on the returned cache, but
- * the @link Cache#stop()} and {@link Cache#destroy()} methods should not
- * be invoked, since it is quite possible other session factories are
- * still using the cache. Use {@link #releaseCache(String)} to notify this
- * factory that the caller is no longer using a cache; let the factory
- * control stopping and destroying the underlying cache.
- * </p>
- *
- * @param configName the name of the configuration
- * @param create should the cache be instantiated if it
- * hasn't already been?
- * @return the cache, or <code>null</code> if
- * <code>create</code> is false and the cache hasn't
- * been created previously.
- *
- * @throws IllegalArgumentException if this object is unaware of
- * <code>configName</code>
- * @throws Exception if there is a problem instantiating the cache
- */
- Cache getCache(String configName, boolean create) throws Exception;
-
- /**
- * Notifies the factory that the caller is no longer using the given
- * cache. The factory may perform cleanup operations, such as
- * stopping and destroying the cache.
- *
- * @param configName
- */
- void releaseCache(String configName);
-
-}
\ No newline at end of file
Deleted: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactoryImpl.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactoryImpl.java 2007-12-23 14:53:06 UTC (rev 14261)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JBossCacheFactoryImpl.java 2007-12-23 14:55:36 UTC (rev 14262)
@@ -1,368 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.cache.jbc2.builder;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.hibernate.cache.CacheException;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheStatus;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.xml.XmlHelper;
-import org.jgroups.ChannelFactory;
-import org.jgroups.JChannelFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSOutput;
-import org.w3c.dom.ls.LSSerializer;
-
-/**
- * A JBossCacheConfigurationFactory. This is a basic prototype of a
- * JBCACHE-1156 solution; only in Hibernate code base for a very short
- * period.
- *
- * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
- * @version $Revision: 1 $
- */
-public class JBossCacheFactoryImpl implements JBossCacheFactory {
-
- private static final Logger log = LoggerFactory.getLogger(JBossCacheFactoryImpl.class);
-
- private static final String DOCUMENT_ROOT = "cache-configs";
- private static final String CONFIG_ROOT = "cache-config";
- private static final String CONFIG_NAME = "name";
-
- private static JBossCacheFactoryImpl sharedFactory;
- private static String sharedChannelFactoryCfg;
-
- private XmlConfigurationParser parser;
- private String configResource;
- private Map configs = new HashMap();
- private Map caches = new HashMap();
- private Map checkouts = new HashMap();
- private ChannelFactory channelFactory;
- private boolean started;
-
- public JBossCacheFactoryImpl(String configResource, ChannelFactory factory) {
-
- parser = new XmlConfigurationParser();
- this.configResource = configResource;
- this.channelFactory = factory;
- }
-
- public static synchronized JBossCacheFactory getSharedInstance(String cacheConfigResource, String channelFactoryConfigResource) {
-
- if (sharedFactory == null) {
- ChannelFactory cf = new JChannelFactory();
- try {
- cf.setMultiplexerConfig(channelFactoryConfigResource);
- }
- catch (Exception e) {
- throw new CacheException("Problem setting ChannelFactory config", e);
- }
- sharedFactory = new JBossCacheFactoryImpl(cacheConfigResource, cf);
- sharedChannelFactoryCfg = channelFactoryConfigResource;
- }
- else {
- // Validate that the provided resources match the existing singleton
- if (!sharedFactory.getConfigResource().equals(cacheConfigResource)) {
- throw new CacheException("Provided cacheConfigResource does " +
- "not match the existing shared factory: provided = " +
- cacheConfigResource + "; existing = " + sharedFactory.getConfigResource());
- }
- else if (!sharedChannelFactoryCfg.equals(channelFactoryConfigResource)) {
- throw new IllegalStateException("Provided channelFactoryConfigResource does " +
- "not match the existing shared factory: provided = " +
- channelFactoryConfigResource + "; existing = " + sharedChannelFactoryCfg);
-
- }
- }
-
- return sharedFactory;
- }
-
- public void start() {
- if (!started) {
- this.configs = parser.parseConfigs(configResource);
- started = true;
- }
- }
-
- public void stop() {
- if (started) {
- synchronized (caches) {
- for (Iterator it = caches.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Entry) it.next();
- destroyCache((Cache) entry.getValue());
- it.remove();
- }
- caches.clear();
- checkouts.clear();
- configs.clear();
- }
- started = false;
- }
- }
-
- public String getConfigResource() {
- return configResource;
- }
-
- public ChannelFactory getChannelFactory() {
- return channelFactory;
- }
-
- public Set getConfigurationNames()
- {
- return new HashSet(configs.keySet());
- }
-
- public Cache getCache(String configName, boolean create) throws Exception
- {
- Cache cache = null;
- synchronized (caches) {
- cache = (Cache) caches.get(configName);
- if (cache == null && create) {
- Configuration config = getConfiguration(configName);
- cache = DefaultCacheFactory.getInstance().createCache(config, false);
- registerCache(cache, configName);
- }
- else if (cache != null) {
- incrementCheckout(configName);
- }
- }
-
- return cache;
- }
-
- private int incrementCheckout(String configName) {
- synchronized (checkouts) {
- Integer count = (Integer) checkouts.get(configName);
- if (count == null)
- count = new Integer(0);
- Integer newVal = new Integer(count.intValue() + 1);
- checkouts.put(configName, newVal);
- return newVal.intValue();
- }
- }
-
- private int decrementCheckout(String configName) {
- synchronized (checkouts) {
- Integer count = (Integer) checkouts.get(configName);
- if (count == null || count.intValue() < 1)
- throw new IllegalStateException("invalid count of " + count + " for " + configName);
-
- Integer newVal = new Integer(count.intValue() - 1);
- checkouts.put(configName, newVal);
- return newVal.intValue();
- }
- }
-
- public void registerCache(Cache cache, String configName) {
- synchronized (caches) {
- if (caches.containsKey(configName))
- throw new IllegalStateException(configName + " already registered");
- caches.put(configName, cache);
- incrementCheckout(configName);
- }
- }
-
- public void releaseCache(String configName) {
-
- synchronized (caches) {
- if (!caches.containsKey(configName))
- throw new IllegalStateException(configName + " not registered");
- if (decrementCheckout(configName) == 0) {
- Cache cache = (Cache) caches.remove(configName);
- destroyCache(cache);
- }
- }
- }
-
- private void destroyCache(Cache cache) {
- if (cache.getCacheStatus() == CacheStatus.STARTED) {
- cache.stop();
- }
- if (cache.getCacheStatus() != CacheStatus.DESTROYED
- && cache.getCacheStatus() != CacheStatus.INSTANTIATED) {
- cache.destroy();
- }
- }
-
- public Configuration getConfiguration(String configName) throws Exception {
- Element element = (Element) configs.get(configName);
- if (element == null)
- throw new IllegalArgumentException("unknown config " + configName);
- Configuration config = parser.parseConfig(element);
- if (channelFactory != null && config.getMultiplexerStack() != null) {
- config.getRuntimeConfig().setMuxChannelFactory(channelFactory);
- }
- return config;
- }
-
- class XmlConfigurationParser extends org.jboss.cache.factories.XmlConfigurationParser {
-
- public Map parseConfigs(String configs) {
- InputStream is = getAsInputStreamFromClassLoader(configs);
- if (is == null)
- {
- if (log.isDebugEnabled())
- log.debug("Unable to find configuration file " + configs + " in classpath; searching for this file on the filesystem instead.");
- try
- {
- is = new FileInputStream(configs);
- }
- catch (FileNotFoundException e)
- {
- throw new ConfigurationException("Unable to find config file " + configs + " either in classpath or on the filesystem!", e);
- }
- }
-
- return parseConfigs(is);
- }
-
- public Map parseConfigs(InputStream stream) {
-
- // loop through all elements in XML.
- Element root = XmlHelper.getDocumentRoot(stream);
- NodeList list = root.getElementsByTagName(CONFIG_ROOT);
- if (list == null || list.getLength() == 0)
- throw new ConfigurationException("Can't find " + CONFIG_ROOT + " tag");
-
- Map result = new HashMap();
-
- for (int i = 0; i < list.getLength(); i++)
- {
- org.w3c.dom.Node node = list.item(i);
- if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
- {
- continue;
- }
-
- Element element = (Element) node;
- String name = element.getAttribute(CONFIG_NAME);
- if (name == null || name.trim().length() == 0)
- throw new ConfigurationException("Element " + element + " has no name attribute");
-
- result.put(name.trim(), element);
- }
-
- return result;
- }
-
- public Configuration parseConfig(Element config) throws Exception {
-
- DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
- Document doc = builder.newDocument();
- Element root = doc.createElement(DOCUMENT_ROOT);
- doc.appendChild(root);
- Node imported = doc.importNode(config, true);
- root.appendChild(imported);
-
- DOMImplementation domImpl = doc.getImplementation();
-
- DOMImplementationLS impl =
- (DOMImplementationLS)domImpl.getFeature("LS", "3.0");
-
- LSSerializer writer = impl.createLSSerializer();
- LSOutput output = impl.createLSOutput();
- output.setEncoding("UTF-8");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- output.setByteStream(baos);
- writer.write(doc, output);
-
- ByteArrayInputStream is = new ByteArrayInputStream(baos.toByteArray());
- return parseStream(is);
- }
-
-
- @Override
- protected Element getMBeanElement(Element root)
- {
- // This is following JBoss convention.
- NodeList list = root.getElementsByTagName(CONFIG_ROOT);
- if (list == null) throw new ConfigurationException("Can't find " + CONFIG_ROOT + " tag");
-
- if (list.getLength() > 1) throw new ConfigurationException("Has multiple " + CONFIG_ROOT + " tag");
-
- Node node = list.item(0);
- Element element = null;
- if (node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE)
- {
- element = (Element) node;
- }
- else
- {
- throw new ConfigurationException("Can't find " + CONFIG_ROOT + " element");
- }
- return element;
- }
-
-
- }
-
- public static void main(String[] args)
- {
- try
- {
- JChannelFactory cf = new JChannelFactory();
- cf.setMultiplexerConfig("stacks.xml");
- JBossCacheFactoryImpl factory = new JBossCacheFactoryImpl("jbc2-configs.xml", cf);
- for (Iterator iter = factory.getConfigurationNames().iterator(); iter.hasNext(); )
- {
- String name = (String) iter.next();
- Cache c = factory.getCache(name, true);
- c.start();
- System.out.println(name + " == " + c);
- factory.releaseCache(name);
- System.out.println(name + " == " + c.getCacheStatus());
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace(System.out);
- }
- }
-}
Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JndiMultiplexingCacheInstanceManager.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JndiMultiplexingCacheInstanceManager.java 2007-12-23 14:53:06 UTC (rev 14261)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/JndiMultiplexingCacheInstanceManager.java 2007-12-23 14:55:36 UTC (rev 14262)
@@ -33,6 +33,7 @@
import org.hibernate.cfg.Settings;
import org.hibernate.util.NamingHelper;
import org.hibernate.util.PropertiesHelper;
+import org.jboss.cache.CacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +50,7 @@
private static final Logger log = LoggerFactory.getLogger(JndiMultiplexingCacheInstanceManager.class);
/**
- * Specifies the JNDI name under which the {@link JBossCacheFactory} to use is bound.
+ * Specifies the JNDI name under which the {@link CacheManager} to use is bound.
* There is no default value -- the user must specify the property.
*/
public static final String CACHE_FACTORY_RESOURCE_PROP = "hibernate.cache.region.jbc2.cachefactory";
@@ -68,18 +69,18 @@
if (name == null)
throw new CacheException("Configuration property " + CACHE_FACTORY_RESOURCE_PROP + " not set");
- JBossCacheFactory cf = locateCacheFactory( name, NamingHelper.getJndiProperties( properties ) );
+ CacheManager cf = locateCacheFactory( name, NamingHelper.getJndiProperties( properties ) );
setCacheFactory( cf );
super.start(settings, properties);
}
- private JBossCacheFactory locateCacheFactory(String jndiNamespace, Properties jndiProperties) {
+ private CacheManager locateCacheFactory(String jndiNamespace, Properties jndiProperties) {
Context ctx = null;
try {
ctx = new InitialContext( jndiProperties );
- return (JBossCacheFactory) ctx.lookup( jndiNamespace );
+ return (CacheManager) ctx.lookup( jndiNamespace );
}
catch (NamingException ne) {
String msg = "Unable to retreive Cache from JNDI [" + jndiNamespace + "]";
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-12-23 14:53:06 UTC (rev 14261)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/builder/MultiplexingCacheInstanceManager.java 2007-12-23 14:55:36 UTC (rev 14262)
@@ -27,6 +27,8 @@
import javax.transaction.TransactionManager;
import org.jboss.cache.Cache;
+import org.jboss.cache.CacheManager;
+import org.jboss.cache.CacheManagerImpl;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.config.Configuration;
import org.jgroups.ChannelFactory;
@@ -106,9 +108,7 @@
public static final String DEF_CACHE_FACTORY_RESOURCE = "org/hibernate/cache/jbc2/builder/jbc2-configs.xml";
/**
* Default value for {@link #CHANNEL_FACTORY_RESOURCE_PROP}. Specifies
- * "stacks.xml", which can be found in the root of the JGroups jar file.
- * Thus, leaving this value at default means using the default protocol
- * stack configs provided by JGroups.
+ * the "jgroups-stacks.xml" file in this package.
*/
public static final String DEF_MULTIPLEXER_RESOURCE = "org/hibernate/cache/jbc2/builder/jgroups-stacks.xml";
/**
@@ -142,7 +142,7 @@
private String tsConfig = null;
/** Our cache factory */
- private JBossCacheFactory jbcFactory;
+ private CacheManager jbcFactory;
/** Our channel factory */
private ChannelFactory channelFactory;
/**
@@ -187,7 +187,7 @@
*
* @return Value for property 'cacheFactory'.
*/
- public JBossCacheFactory getCacheFactory() {
+ public CacheManager getCacheFactory() {
return jbcFactory;
}
@@ -197,7 +197,7 @@
*
* @param factory Value to set for property 'cacheFactory'.
*/
- public void setCacheFactory(JBossCacheFactory factory) {
+ public void setCacheFactory(CacheManager factory) {
this.jbcFactory = factory;
}
@@ -288,9 +288,8 @@
}
String factoryRes = PropertiesHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, DEF_CACHE_FACTORY_RESOURCE);
- // FIXME use an impl from JBossCache
- jbcFactory = new JBossCacheFactoryImpl(factoryRes, channelFactory);
- ((JBossCacheFactoryImpl) jbcFactory).start();
+ jbcFactory = new CacheManagerImpl(factoryRes, channelFactory);
+ ((CacheManagerImpl) jbcFactory).start();
selfCreatedFactory = true;
}
@@ -390,7 +389,7 @@
public void stop() {
releaseCaches();
if (selfCreatedFactory) {
- ((JBossCacheFactoryImpl) jbcFactory).stop();
+ ((CacheManagerImpl) jbcFactory).stop();
}
}
16 years, 11 months
Hibernate SVN: r14261 - core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:53:06 -0500 (Sun, 23 Dec 2007)
New Revision: 14261
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractGeneralDataRegionTestCase.java
Log:
Update evict/removeAll tests to reflect JBCACHE-1251 problem
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractGeneralDataRegionTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractGeneralDataRegionTestCase.java 2007-12-23 14:52:02 UTC (rev 14260)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/AbstractGeneralDataRegionTestCase.java 2007-12-23 14:53:06 UTC (rev 14261)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.Set;
+import org.hibernate.cache.CacheException;
import org.hibernate.cache.GeneralDataRegion;
import org.hibernate.cache.QueryResultsRegion;
import org.hibernate.cache.Region;
@@ -215,6 +216,24 @@
assertFalse(regionRoot == null);
assertEquals(0, regionRoot.getChildrenNames().size());
assertTrue(regionRoot.isResident());
+
+ if (CacheHelper.isClusteredInvalidation(remoteCache)) {
+ // With invalidation, a node that removes the region root cannot reestablish
+ // it on remote nodes, since the only message the propagates is "invalidate".
+ // So, we have to reestablish it ourselves
+
+ // First, do a get to help test whether a get messes up the optimistic version
+ String msg = "Known issue JBCACHE-1251 -- problem reestablishing invalidated region root";
+ try {
+ assertEquals(null, remoteRegion.get(KEY));
+ }
+ catch (CacheException ce) {
+ log.error(msg, ce);
+ fail(msg + " -- cause: " + ce);
+ }
+ remoteRegion.put(KEY, VALUE1);
+ assertEquals(msg, VALUE1, remoteRegion.get(KEY));
+ }
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
16 years, 11 months
Hibernate SVN: r14260 - core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:52:02 -0500 (Sun, 23 Dec 2007)
New Revision: 14260
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
Log:
Update evict/removeAll tests to reflect JBCACHE-1251 problem
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-12-23 14:50:54 UTC (rev 14259)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2007-12-23 14:52:02 UTC (rev 14260)
@@ -33,6 +33,7 @@
import junit.framework.TestSuite;
import org.hibernate.cache.CacheDataDescription;
+import org.hibernate.cache.CacheException;
import org.hibernate.cache.EntityRegion;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.access.EntityRegionAccessStrategy;
@@ -687,6 +688,24 @@
assertEquals(0, regionRoot.getChildrenNames().size());
assertTrue(regionRoot.isResident());
+ if (isUsingInvalidation()) {
+ // With invalidation, a node that removes the region root cannot reestablish
+ // it on remote nodes, since the only message the propagates is "invalidate".
+ // So, we have to reestablish it ourselves
+
+ // First, do a get to help test whether a get messes up the optimistic version
+ String msg = "Known issue JBCACHE-1251 -- problem reestablishing invalidated region root";
+ try {
+ assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
+ }
+ catch (CacheException ce) {
+ log.error(msg, ce);
+ fail(msg + " -- cause: " + ce);
+ }
+ remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
+ assertEquals(msg, VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
+ }
+
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
if (isUsingInvalidation()) {
@@ -706,7 +725,7 @@
}
private void checkNodeIsEmpty(Node node) {
- assertEquals("Known issue JBCACHE-1200. node " + node.getFqn() + " should not have keys", 0, node.getKeys().size());
+ assertEquals(node.getFqn() + " should not have keys", 0, node.getKeys().size());
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
checkNodeIsEmpty((Node) it.next());
}
16 years, 11 months
Hibernate SVN: r14259 - core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:50:54 -0500 (Sun, 23 Dec 2007)
New Revision: 14259
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
Log:
Fix putFromLoad tests
Update evict/removeAll tests to reflect JBCACHE-1251 problem
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-12-23 14:49:34 UTC (rev 14258)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2007-12-23 14:50:54 UTC (rev 14259)
@@ -33,6 +33,7 @@
import junit.framework.TestSuite;
import org.hibernate.cache.CacheDataDescription;
+import org.hibernate.cache.CacheException;
import org.hibernate.cache.CollectionRegion;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
@@ -289,7 +290,7 @@
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
- assertNull("node1 starts clean", remoteAccessStrategy.get(KEY, txTimestamp));
+ assertNull("node2 starts clean", remoteAccessStrategy.get(KEY, txTimestamp));
// Let node1 write
writeLatch1.countDown();
@@ -348,22 +349,12 @@
Object expected1 = null;
Object expected2 = null;
if (isUsingInvalidation()) {
- if (isUsingOptimisticLocking()) {
- expected1 = null; // the initial VALUE2 DataVersion should prevent the node2 put
- expected2 = VALUE2;
-
- // We know this case fails
- msg1 = msg2 = "Known issue JBCACHE-1203";
- }
- else {
- // node2 can write since there is no data version
- // We count on db locking to prevent this case
- expected1 = VALUE1;
- expected2 = null; // invalidated by node2
-
- // We know this case fails
- msg1 = msg2 = "Known issue JBCACHE-1203";
- }
+ // PFER does not generate any invalidation, so each node should
+ // succeed. We count on database locking and Hibernate removing
+ // the collection on any update to prevent the situation we have
+ // here where the caches have inconsistent data
+ expected1 = VALUE2;
+ expected2 = VALUE1;
}
else {
// the initial VALUE2 should prevent the node2 put
@@ -488,6 +479,24 @@
assertEquals(0, regionRoot.getChildrenNames().size());
assertTrue(regionRoot.isResident());
+ if (isUsingInvalidation()) {
+ // With invalidation, a node that removes the region root cannot reestablish
+ // it on remote nodes, since the only message the propagates is "invalidate".
+ // So, we have to reestablish it ourselves
+
+ // First, do a get to help test whether a get messes up the optimistic version
+ String msg = "Known issue JBCACHE-1251 -- problem reestablishing invalidated region root";
+ try {
+ assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
+ }
+ catch (CacheException ce) {
+ log.error(msg, ce);
+ fail(msg + " -- cause: " + ce);
+ }
+ remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
+ assertEquals(msg, VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
+ }
+
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
if (isUsingInvalidation()) {
@@ -507,7 +516,7 @@
}
private void checkNodeIsEmpty(Node node) {
- assertEquals("Known issue JBCACHE-1200. node " + node.getFqn() + " should not have keys", 0, node.getKeys().size());
+ assertEquals(node.getFqn() + " should not have keys", 0, node.getKeys().size());
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
checkNodeIsEmpty((Node) it.next());
}
16 years, 11 months
Hibernate SVN: r14258 - core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:49:34 -0500 (Sun, 23 Dec 2007)
New Revision: 14258
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticInvalidatedTransactionalTestCase.java
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticReadOnlyTestCase.java
Log:
Fix putFromLoad tests
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java 2007-12-23 14:46:37 UTC (rev 14257)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticInvalidatedTransactionalTestCase.java 2007-12-23 14:49:34 UTC (rev 14258)
@@ -65,12 +65,5 @@
public void testRemoveAllFailureExpected() {
super.testRemoveAll();
}
-
- public void testPutFromLoadFailureExpected() throws Exception {
- super.testPutFromLoad();
- }
-
- public void testPutFromLoadMinimalFailureExpected() throws Exception {
- super.testPutFromLoadMinimal();
- }
+
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java 2007-12-23 14:46:37 UTC (rev 14257)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/OptimisticReadOnlyTestCase.java 2007-12-23 14:49:34 UTC (rev 14258)
@@ -65,12 +65,4 @@
super.testRemoveAll();
}
- public void testPutFromLoadFailureExpected() throws Exception {
- super.testPutFromLoad();
- }
-
- public void testPutFromLoadMinimalFailureExpected() throws Exception {
- super.testPutFromLoadMinimal();
- }
-
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticInvalidatedTransactionalTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticInvalidatedTransactionalTestCase.java 2007-12-23 14:46:37 UTC (rev 14257)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticInvalidatedTransactionalTestCase.java 2007-12-23 14:49:34 UTC (rev 14258)
@@ -63,14 +63,6 @@
public void testRemoveAllFailureExpected() {
super.testRemoveAll();
- }
+ }
- public void testPutFromLoadFailureExpected() throws Exception {
- super.testPutFromLoad();
- }
-
- public void testPutFromLoadMinimalFailureExpected() throws Exception {
- super.testPutFromLoadMinimal();
- }
-
}
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticReadOnlyTestCase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticReadOnlyTestCase.java 2007-12-23 14:46:37 UTC (rev 14257)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/PessimisticReadOnlyTestCase.java 2007-12-23 14:49:34 UTC (rev 14258)
@@ -57,14 +57,6 @@
public void testRemoveAllFailureExpected() {
super.testRemoveAll();
}
-
- public void testPutFromLoadFailureExpected() throws Exception {
- super.testPutFromLoad();
- }
-
- public void testPutFromLoadMinimalFailureExpected() throws Exception {
- super.testPutFromLoadMinimal();
- }
// Overrides
16 years, 11 months
Hibernate SVN: r14257 - core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-23 09:46:37 -0500 (Sun, 23 Dec 2007)
New Revision: 14257
Modified:
core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jgroups-stacks.xml
Log:
Remove deprecated GMS.join_retry_timeout
Modified: core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jgroups-stacks.xml
===================================================================
--- core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jgroups-stacks.xml 2007-12-21 19:52:35 UTC (rev 14256)
+++ core/trunk/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jgroups-stacks.xml 2007-12-23 14:46:37 UTC (rev 14257)
@@ -80,8 +80,9 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true"
+ join_timeout="3000"
+ shun="false"
view_bundling="true"
view_ack_collection_timeout="5000"/>
<FC max_credits="2000000"
@@ -148,8 +149,9 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true"
+ join_timeout="3000"
+ shun="false"
view_bundling="true"/>
<FRAG2 frag_size="60000" />
<pbcast.STREAMING_STATE_TRANSFER/>
@@ -211,8 +213,9 @@
discard_delivered_msgs="false"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true"
+ join_timeout="3000"
+ shun="false"
view_bundling="true"/>
<FC max_credits="2000000"
min_threshold="0.10"/>
@@ -274,8 +277,9 @@
discard_delivered_msgs="false"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true"
+ join_timeout="3000"
+ shun="false"
view_bundling="true"/>
<pbcast.STREAMING_STATE_TRANSFER/>
<!-- <pbcast.STATE_TRANSFER/> -->
@@ -303,8 +307,9 @@
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="5000"
max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- join_retry_timeout="2000" shun="false"
+ <pbcast.GMS print_local_addr="true"
+ join_timeout="3000"
+ shun="false"
view_bundling="true"
view_ack_collection_timeout="5000"/>
<FC max_credits="2000000"
16 years, 11 months
Hibernate SVN: r14256 - core/trunk/cache-jbosscache2.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2007-12-21 14:52:35 -0500 (Fri, 21 Dec 2007)
New Revision: 14256
Modified:
core/trunk/cache-jbosscache2/pom.xml
Log:
Move to JBC 2.1.0.CR2/JGroups 2.6.1
Add some properties that testsuite can set for faster test execution
Modified: core/trunk/cache-jbosscache2/pom.xml
===================================================================
--- core/trunk/cache-jbosscache2/pom.xml 2007-12-21 19:51:44 UTC (rev 14255)
+++ core/trunk/cache-jbosscache2/pom.xml 2007-12-21 19:52:35 UTC (rev 14256)
@@ -27,12 +27,15 @@
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
- <!-- I'd prefer this, at least until we get a GA...
- <version>[2.0.0.BETA2,)</version>
- -->
- <version>2.1.0.BETA1</version>
+ <version>2.1.0.CR2</version>
+ </dependency>
+ <!-- TODO Remove once JBC 2.1.0.GA uses JG 2.6.1 -->
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.6.1</version>
</dependency>
-
+
<!-- test dependencies -->
<dependency>
<groupId>${groupId}</groupId>
@@ -124,7 +127,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <configuration>
+ <configuration>
+ <excludes>
+ <!-- Skip a long-running test of a prototype class -->
+ <exclude>**/ClusteredConcurrentTimestampRegionTestCase.java</exclude>
+ </excludes>
<systemProperties>
<property>
<name>hibernate.test.validatefailureexpected</name>
@@ -143,6 +150,30 @@
<property>
<name>java.net.preferIPv4Stack</name>
<value>true</value>
+ </property>
+ <!-- Tell JGroups to only wait a short time for PING
+ responses before determining coordinator. Speeds cluster
+ formation during integration tests. (This is too
+ low a value for a real system; only use for tests.)
+ -->
+ <property>
+ <name>jgroups.ping.timeout</name>
+ <value>500</value>
+ </property>
+ <!-- Tell JGroups to only require one PING response
+ before determining coordinator. Speeds cluster
+ formation during integration tests. (This is too
+ low a value for a real system; only use for tests.)
+ -->
+ <property>
+ <name>jgroups.ping.num_initial_members</name>
+ <value>1</value>
+ </property>
+ <!-- Disable the JGroups message bundling feature
+ to speed tests and avoid FLUSH issue -->
+ <property>
+ <name>jgroups.udp.enable_bundling</name>
+ <value>false</value>
</property>
</systemProperties>
<skipExec>${skipUnitTests}</skipExec>
16 years, 11 months