db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r190521 - in /incubator/jdo/trunk/tck20/test: conf/ java/org/apache/jdo/tck/api/persistencemanager/cache/
Date Mon, 13 Jun 2005 22:23:37 GMT
Author: mcaisse
Date: Mon Jun 13 15:23:35 2005
New Revision: 190521

URL: http://svn.apache.org/viewcvs?rev=190521&view=rev
Log:
JDO-59 fix by Michael Watzek. Named threads, stop if thread throws exception to avoid deadlock

Modified:
    incubator/jdo/trunk/tck20/test/conf/alltests.list
    incubator/jdo/trunk/tck20/test/conf/exclude.list
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java

Modified: incubator/jdo/trunk/tck20/test/conf/alltests.list
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/conf/alltests.list?rev=190521&r1=190520&r2=190521&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/alltests.list (original)
+++ incubator/jdo/trunk/tck20/test/conf/alltests.list Mon Jun 13 15:23:35 2005
@@ -125,6 +125,10 @@
 org.apache.jdo.tck.api.persistencemanager.cache.PassingNullToEvictHasNoEffect \
 org.apache.jdo.tck.api.persistencemanager.cache.PassingNullToRefreshAllThrowsException \
 org.apache.jdo.tck.api.persistencemanager.cache.PassingNullToRefreshHasNoEffect \
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllNoParameterSideEffects \
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithArraySideEffects \
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithCollectionSideEffects \
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshSideEffects \
 org.apache.jdo.tck.api.persistencemanager.cache.Retrieve \
 org.apache.jdo.tck.api.persistencemanager.SameTransactionInstanceForAllCallsToCurrentTransaction
\
 org.apache.jdo.tck.api.persistencemanager.flags.SetIgnoreCacheToFalse \

Modified: incubator/jdo/trunk/tck20/test/conf/exclude.list
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/conf/exclude.list?rev=190521&r1=190520&r2=190521&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/exclude.list (original)
+++ incubator/jdo/trunk/tck20/test/conf/exclude.list Mon Jun 13 15:23:35 2005
@@ -1,8 +1,3 @@
 jdo.tck.exclude = \
 org.apache.jdo.tck.enhancement.FieldAccessModified \
-org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable \
-org.apache.jdo.tck.lifecycle.PMsCanSharePCClassesButNotPCInstances \
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllNoParameterSideEffects \
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithArraySideEffects \
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithCollectionSideEffects \
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshSideEffects
+org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java?rev=190521&r1=190520&r2=190521&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
Mon Jun 13 15:23:35 2005
@@ -19,10 +19,13 @@
 import java.util.Collection;
 import java.util.HashSet;
 
+import javax.jdo.JDOFatalException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Transaction;
 
+import junit.framework.AssertionFailedError;
+
 import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -93,9 +96,9 @@
         
         ThreadExceptionHandler group = new ThreadExceptionHandler();
         ThreadT1 thread1 = new ThreadT1(pm1);
-        Thread  T1 = new Thread(group, thread1);
+        Thread  T1 = new Thread(group, thread1, "T1");
         ThreadT2 thread2 = new ThreadT2(pm2);
-        Thread  T2 = new Thread(group, thread2);
+        Thread  T2 = new Thread(group, thread2, "T2");
         thread1.setOther(thread2);
         thread2.setOther(thread1);
         
@@ -107,21 +110,17 @@
         
         Throwable t1Problem = group.getUncaughtException(T1);
         if (t1Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllNoParameterSideEffects ThreadT1 results in uncaught
exception");
-                t1Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT1 results in exception " + t1Problem);
+            if (t1Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t1Problem;
+            else
+                throw new JDOFatalException( "Thread "+T1.getName()+" results in exception
", t1Problem );
         }
         Throwable t2Problem = group.getUncaughtException(T2);
         if (t2Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllNoParameterSideEffects ThreadT2 results in uncaught
exception");
-                t2Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT2 results in exception " + t2Problem);
+            if (t2Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t2Problem;
+            else
+                throw new JDOFatalException( "Thread "+T2.getName()+" results in exception
", t2Problem );
         }
         
         if (debug) logger.debug ("END RefreshAllNoParameterSideEffects");
@@ -187,6 +186,7 @@
                     "  ThreadT1: commit finished.");
             }
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -232,6 +232,7 @@
                 Collection col1 = new HashSet();
                 col1.add(p1);
                 col1.add(p2);
+                
                 pm.makePersistentAll(col1);
                 pm.refreshAll();
                 done = true; 
@@ -253,6 +254,7 @@
                     "  ThreadT2: commit finished.");
             }
             finally {
+                done = true; 
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java?rev=190521&r1=190520&r2=190521&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
Mon Jun 13 15:23:35 2005
@@ -19,10 +19,13 @@
 import java.util.Collection;
 import java.util.HashSet;
 
+import javax.jdo.JDOFatalException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Transaction;
 
+import junit.framework.AssertionFailedError;
+
 import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -88,9 +91,9 @@
 
         ThreadExceptionHandler group = new ThreadExceptionHandler();
         RefreshArrThreadT1 thread1 = new RefreshArrThreadT1(pm1);
-        Thread  T1 = new Thread(group, thread1);
+        Thread  T1 = new Thread(group, thread1, "T1");
         RefreshArrThreadT2 thread2 = new RefreshArrThreadT2(pm2);
-        Thread  T2 = new Thread(group, thread2);
+        Thread  T2 = new Thread(group, thread2, "T2");
         thread1.setOther(thread2);
         thread2.setOther(thread1);
         
@@ -102,21 +105,17 @@
         
         Throwable t1Problem = group.getUncaughtException(T1);
         if (t1Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllWithArraySideEffects ThreadT1 results in uncaught
exception");
-                t1Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT1 results in exception " + t1Problem);
+            if (t1Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t1Problem;
+            else
+                throw new JDOFatalException( "Thread "+T1.getName()+" results in exception
", t1Problem );
         }
         Throwable t2Problem = group.getUncaughtException(T2);
         if (t2Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllWithArraySideEffects ThreadT2 results in uncaught
exception");
-                t2Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT2 results in exception " + t2Problem);
+            if (t2Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t2Problem;
+            else
+                throw new JDOFatalException( "Thread "+T2.getName()+" results in exception
", t2Problem );
         }
 
         if (debug) logger.debug ("END RefreshAllWithArraySideEffects");
@@ -155,11 +154,11 @@
                 tx.begin();
                 n1.setX(500);
                 n2.setX(501);
-
+                
                 Collection col1 = new HashSet();
                 col1.add(n1);
                 col1.add(n2);
-
+                
                 pm.makePersistentAll(col1);
                 pm.refreshAll(col1.toArray());
                 RefreshAllWithArraySideEffects.this.logger.debug(
@@ -181,6 +180,7 @@
                     "  ThreadT1: commit finished.");
             } 
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -222,16 +222,18 @@
                 tx.begin();
                 p1.setX(200);
                 p2.setX(201);
-
+                
                 Collection col1 = new HashSet();
                 col1.add(p1);
                 col1.add(p2);
+                
                 pm.makePersistentAll(col1);
                 pm.refreshAll(col1.toArray());
                 done = true;
-
+                
                 RefreshAllWithArraySideEffects.this.logger.debug(
                     "  ThreadT2: waiting for commit of ThreadT1");
+
                 while (!other.isCommitDone()) {
                     try {
                         Thread.sleep(DELAY);
@@ -246,6 +248,7 @@
                     "  ThreadT2: commit finished.");
             } 
             finally {
+                done = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java?rev=190521&r1=190520&r2=190521&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
Mon Jun 13 15:23:35 2005
@@ -19,10 +19,13 @@
 import java.util.Collection;
 import java.util.HashSet;
 
+import javax.jdo.JDOFatalException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Transaction;
 
+import junit.framework.AssertionFailedError;
+
 import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -88,9 +91,9 @@
 
         ThreadExceptionHandler group = new ThreadExceptionHandler();
         RefreshColThreadT1 thread1 = new RefreshColThreadT1(pm1);
-        Thread  T1 = new Thread(group, thread1);
+        Thread  T1 = new Thread(group, thread1, "T1");
         RefreshColThreadT2 thread2 = new RefreshColThreadT2(pm2);
-        Thread  T2 = new Thread(group, thread2);
+        Thread  T2 = new Thread(group, thread2, "T2");
         thread1.setOther(thread2);
         thread2.setOther(thread1);
         
@@ -102,21 +105,17 @@
         
         Throwable t1Problem = group.getUncaughtException(T1);
         if (t1Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllWithCollectionSideEffects ThreadT1 results in uncaught
exception");
-                t1Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT1 results in exception " + t1Problem);
+            if (t1Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t1Problem;
+            else
+                throw new JDOFatalException( "Thread "+T1.getName()+" results in exception
", t1Problem );
         }
         Throwable t2Problem = group.getUncaughtException(T2);
         if (t2Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllWithCollectionSideEffects ThreadT2 results in uncaught
exception");
-                t2Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT2 results in exception " + t2Problem);
+            if (t2Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t2Problem;
+            else
+                throw new JDOFatalException( "Thread "+T2.getName()+" results in exception
", t2Problem );
         }
 
         if (debug) logger.debug("END RefreshAllWithCollectionSideEffects");
@@ -181,6 +180,7 @@
                     "  ThreadT1: commit finished.");
             } 
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -245,6 +245,7 @@
                     "  ThreadT2: commit finished.");
             } 
             finally {
+                done = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java?rev=190521&r1=190520&r2=190521&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java
Mon Jun 13 15:23:35 2005
@@ -16,10 +16,13 @@
 
 package org.apache.jdo.tck.api.persistencemanager.cache;
 
+import javax.jdo.JDOFatalException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Transaction;
 
+import junit.framework.AssertionFailedError;
+
 import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -84,9 +87,9 @@
 
         ThreadExceptionHandler group = new ThreadExceptionHandler();
         RefreshThreadT1 thread1 = new RefreshThreadT1(pm1);
-        Thread T1 = new Thread(group, thread1);
+        Thread T1 = new Thread(group, thread1, "T1");
         RefreshThreadT2 thread2 = new RefreshThreadT2(pm2);
-        Thread T2 = new Thread(group, thread2);
+        Thread T2 = new Thread(group, thread2, "T2");
         thread1.setOther(thread2);
         thread2.setOther(thread1);
 
@@ -98,21 +101,17 @@
         
         Throwable t1Problem = group.getUncaughtException(T1);
         if (t1Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllNoParameterSideEffects ThreadT1 results in uncaught
exception");
-                t1Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT1 results in exception " + t1Problem);
+            if (t1Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t1Problem;
+            else
+                throw new JDOFatalException( "Thread "+T1.getName()+" results in exception
", t1Problem );
         }
         Throwable t2Problem = group.getUncaughtException(T2);
         if (t2Problem != null) {
-            if (debug) {
-                logger.debug("RefreshAllNoParameterSideEffects ThreadT2 results in uncaught
exception");
-                t2Problem.printStackTrace();
-            }
-            fail(ASSERTION_FAILED,
-                 "ThreadT2 results in exception " + t2Problem);
+            if (t2Problem instanceof AssertionFailedError)
+                throw (AssertionFailedError)t2Problem;
+            else
+                throw new JDOFatalException( "Thread "+T2.getName()+" results in exception
", t2Problem );
         }
 
         if (debug) logger.debug ("END RefreshSideEffects");
@@ -171,6 +170,7 @@
                     "  ThreadT1: commit finished.");
             }
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -230,6 +230,7 @@
                     "  ThreadT2: commit finished.");
             } 
             finally {
+                done = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }



Mime
View raw message