db-jdo-commits mailing list archives

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

URL: http://svn.apache.org/viewcvs?rev=190507&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=190507&r1=190506&r2=190507&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/alltests.list (original)
+++ incubator/jdo/trunk/tck20/test/conf/alltests.list Mon Jun 13 13:59:15 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=190507&r1=190506&r2=190507&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/exclude.list (original)
+++ incubator/jdo/trunk/tck20/test/conf/exclude.list Mon Jun 13 13:59:15 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=190507&r1=190506&r2=190507&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 13:59:15 2005
@@ -54,6 +54,9 @@
     /** */
     static final int DELAY = 100;
 
+    /** This object is used for synchronizing concurrent makePersistentAll calls. */
+    private static final Object synchronizationObject = new Object();
+    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -166,7 +169,9 @@
                 col1.add(n1);
                 col1.add(n2);
 
-                pm.makePersistentAll(col1);
+                synchronized (synchronizationObject) {
+                    pm.makePersistentAll(col1);
+                }
                 pm.refreshAll();
 
                 RefreshAllNoParameterSideEffects.this.logger.debug(
@@ -187,6 +192,7 @@
                     "  ThreadT1: commit finished.");
             }
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -232,7 +238,10 @@
                 Collection col1 = new HashSet();
                 col1.add(p1);
                 col1.add(p2);
-                pm.makePersistentAll(col1);
+                
+                synchronized (synchronizationObject) {
+                    pm.makePersistentAll(col1);
+                }
                 pm.refreshAll();
                 done = true; 
 
@@ -253,6 +262,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=190507&r1=190506&r2=190507&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 13:59:15 2005
@@ -55,6 +55,9 @@
     /** */
     static final int DELAY = 100;
 
+    /** This object is used for synchronizing concurrent makePersistentAll calls. */
+    private static final Object synchronizationObject = new Object();
+    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -155,12 +158,14 @@
                 tx.begin();
                 n1.setX(500);
                 n2.setX(501);
-
+                
                 Collection col1 = new HashSet();
                 col1.add(n1);
                 col1.add(n2);
-
-                pm.makePersistentAll(col1);
+                
+                synchronized (synchronizationObject) {
+                    pm.makePersistentAll(col1);
+                }
                 pm.refreshAll(col1.toArray());
                 RefreshAllWithArraySideEffects.this.logger.debug(
                     "  ThreadT1: waiting for ThreadT2.done");
@@ -181,6 +186,7 @@
                     "  ThreadT1: commit finished.");
             } 
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -222,16 +228,20 @@
                 tx.begin();
                 p1.setX(200);
                 p2.setX(201);
-
+                
                 Collection col1 = new HashSet();
                 col1.add(p1);
                 col1.add(p2);
-                pm.makePersistentAll(col1);
+                
+                synchronized (synchronizationObject) {
+                    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 +256,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=190507&r1=190506&r2=190507&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 13:59:15 2005
@@ -55,6 +55,9 @@
     /** */
     static final int DELAY = 100;
 
+    /** This object is used for synchronizing concurrent makePersistentAll calls. */
+    private static final Object synchronizationObject = new Object();
+    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -160,7 +163,9 @@
                 col1.add(n1);
                 col1.add(n2);
 
-                pm.makePersistentAll(col1);
+                synchronized (synchronizationObject) {
+                    pm.makePersistentAll(col1);
+                }
                 pm.refreshAll(col1);
                 RefreshAllWithCollectionSideEffects.this.logger.debug(
                     "  ThreadT1: waiting for ThreadT2.done");
@@ -181,6 +186,7 @@
                     "  ThreadT1: commit finished.");
             } 
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -225,7 +231,9 @@
                 Collection col1 = new HashSet();
                 col1.add(p1);
                 col1.add(p2);
-                pm.makePersistentAll(col1);
+                synchronized (synchronizationObject) {
+                    pm.makePersistentAll(col1);
+                }
                 pm.refreshAll(col1);
                 done = true;
 
@@ -245,6 +253,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=190507&r1=190506&r2=190507&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 13:59:15 2005
@@ -51,6 +51,9 @@
     /** */
     static final int DELAY = 100;
 
+    /** This object is used for synchronizing concurrent makePersistentAll calls. */
+    private static final Object synchronizationObject = new Object();
+    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -150,7 +153,9 @@
                 RefreshSideEffects.this.logger.debug("  ThreadT1: START");
                 tx.begin();
                 n1.setX(500);
-                pm.makePersistent(n1);
+                synchronized (synchronizationObject) {
+                    pm.makePersistent(n1);
+                }
                 pm.refresh(n1);
 
                 RefreshSideEffects.this.logger.debug(
@@ -171,6 +176,7 @@
                     "  ThreadT1: commit finished.");
             }
             finally {
+                commitDone = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }
@@ -210,7 +216,9 @@
                 RefreshSideEffects.this.logger.debug("  ThreadT2: START");
                 tx.begin();
                 p1.setX(201);
-                pm.makePersistent(p1);
+                synchronized (synchronizationObject) {
+                    pm.makePersistent(p1);
+                }
                 pm.refresh(p1);
                 done = true;
 
@@ -230,6 +238,7 @@
                     "  ThreadT2: commit finished.");
             } 
             finally {
+                done = true;
                 if ((tx != null) && tx.isActive())
                     tx.rollback();
             }



Mime
View raw message