[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/buddyreplication ...
Manik Surtani
msurtani at jboss.com
Fri Nov 10 15:03:34 EST 2006
User: msurtani
Date: 06/11/10 15:03:34
Modified: tests/functional/org/jboss/cache/buddyreplication Tag:
Branch_JBossCache_1_4_0
BuddyReplicationWithCacheLoaderTest.java
BuddyReplicationTestsBase.java
BuddyReplicationWithTransactionsTest.java
Log:
fixed concurrency deadlocks when buddies start up
Revision Changes Path
No revision
No revision
1.4.2.1 +2 -2 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationWithCacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -b -r1.4 -r1.4.2.1
--- BuddyReplicationWithCacheLoaderTest.java 25 May 2006 16:36:54 -0000 1.4
+++ BuddyReplicationWithCacheLoaderTest.java 10 Nov 2006 20:03:34 -0000 1.4.2.1
@@ -154,7 +154,7 @@
assertTrue("should exist in loader0", loaders[0].exists(fqn));
// test that data does not exist in loader1
- assertTrue("should not exist in loader1", passivation ? loaders[1].exists(fqn) : !loaders[1].exists(fqn));
+ assertTrue("should not exist in loader1", !loaders[1].exists(fqn));
// test that data does exist in loader2
assertTrue("should exist in loader2", passivation ? !loaders[2].exists(fqn) : loaders[2].exists(fqn));
@@ -175,7 +175,7 @@
assertTrue("should not exist in cache2", !caches[2].exists(b2));
// test that bkup does exist in loader0
- assertTrue("should not exist in loader0", passivation ? loaders[0].exists(b1) : !loaders[0].exists(b1));
+ assertTrue("should not exist in loader0", !loaders[0].exists(b1));
assertTrue("should exist in loader0", passivation ? !loaders[0].exists(b2) : loaders[0].exists(b2));
// test that bkup does not exist in loader1
1.26.2.5 +25 -21 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationTestsBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java,v
retrieving revision 1.26.2.4
retrieving revision 1.26.2.5
diff -u -b -r1.26.2.4 -r1.26.2.5
--- BuddyReplicationTestsBase.java 8 Nov 2006 16:44:18 -0000 1.26.2.4
+++ BuddyReplicationTestsBase.java 10 Nov 2006 20:03:34 -0000 1.26.2.5
@@ -7,14 +7,15 @@
package org.jboss.cache.buddyreplication;
import junit.framework.TestCase;
-import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.TreeCache;
import org.jboss.cache.TreeCacheMBean;
import org.jboss.cache.config.Option;
+import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.xml.XmlHelper;
+import javax.transaction.TransactionManager;
import java.io.File;
/**
@@ -78,11 +79,11 @@
// Call the hook that allows mux integration if that's what the test wants
configureMultiplexer(c);
- c.createService();
+
if (start)
{
+ c.createService();
c.startService();
-
validateMultiplexer(c);
}
@@ -204,7 +205,7 @@
return caches;
}
- protected void cleanup(TreeCache[] caches)
+ protected void cleanup(TreeCache[] caches) throws Exception
{
System.out.println("*** cleaning up");
Option localOnly = new Option();
@@ -217,26 +218,29 @@
{
if (caches[i] != null)
{
- try
+ destroyCache(caches[i]);
+ }
+ caches[i] = null;
+ }
+ }
+ }
+
+ private void destroyCache(TreeCache c) throws Exception
{
- try
+ TransactionManager tm = c.getTransactionManager();
+ if (tm != null && tm.getTransaction() != null)
{
- caches[i].remove(Fqn.ROOT, localOnly);
- }
- catch (CacheException e)
+ try
{
- e.printStackTrace(System.out);
- }
- caches[i].stopService();
+ tm.rollback();
}
catch (Exception e)
{
- e.printStackTrace(System.out);
- }
- caches[i] = null;
- }
}
}
+ CacheLoader cl = c.getCacheLoader();
+ if (cl != null) cl.remove(Fqn.ROOT);
+ c.stopService();
}
protected void printBuddyGroup(TreeCache cache)
1.2.2.2 +2 -2 JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyReplicationWithTransactionsTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -b -r1.2.2.1 -r1.2.2.2
--- BuddyReplicationWithTransactionsTest.java 10 Jul 2006 12:17:35 -0000 1.2.2.1
+++ BuddyReplicationWithTransactionsTest.java 10 Nov 2006 20:03:34 -0000 1.2.2.2
@@ -6,8 +6,8 @@
*/
package org.jboss.cache.buddyreplication;
-import org.jboss.cache.TreeCache;
import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
import javax.transaction.TransactionManager;
@@ -24,7 +24,7 @@
private String value = "value";
private TreeCache[] caches;
- protected void tearDown()
+ protected void tearDown() throws Exception
{
if (caches != null)
{
More information about the jboss-cvs-commits
mailing list