openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r749497 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/LockManagerTestBase.java
Date Tue, 03 Mar 2009 00:38:28 GMT
Author: allee8285
Date: Tue Mar  3 00:38:28 2009
New Revision: 749497

URL: http://svn.apache.org/viewvc?rev=749497&view=rev
Log:
OPENJPA-891 - correct tests failure due to CPU speed sensitive wait between threads interaction.

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/LockManagerTestBase.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/LockManagerTestBase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/LockManagerTestBase.java?rev=749497&r1=749496&r2=749497&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/LockManagerTestBase.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/LockManagerTestBase.java
Tue Mar  3 00:38:28 2009
@@ -81,6 +81,8 @@
     protected static final String TxtThread1                 = "T1: ";
     protected static final String TxtThread2                 = "T2: ";
     
+    protected static final int MinThreadWaitInMs             = 30000;
+    
     protected enum CommitAction {
         Commit, Rollback
     };
@@ -154,7 +156,7 @@
         if (waitInMsec == -1) {
             speedCnt = platformSpeedTest();
             try {
-                waitInMsec = 500000 / (speedCnt / 1000000);
+                waitInMsec = MinThreadWaitInMs + 500000 / (speedCnt / 1000000);
             } catch (Throwable t) {
             }
         }
@@ -507,16 +509,13 @@
             if (thread2Resume == ThreadToResumeFirst.ResumeThread1) {
                 Thread.sleep(computeSleepFromTimeout(t1Timeout));
                 t1.resumeEmAction();
-            } else {
                 Thread.sleep(computeSleepFromTimeout(t2Timeout));
                 t2.resumeEmAction();
-            }
-            if (thread2Resume == ThreadToResumeFirst.ResumeThread2) {
-                Thread.sleep(computeSleepFromTimeout(t1Timeout));
-                t1.resumeEmAction();
             } else {
                 Thread.sleep(computeSleepFromTimeout(t2Timeout));
                 t2.resumeEmAction();
+                Thread.sleep(computeSleepFromTimeout(t1Timeout));
+                t1.resumeEmAction();
             }
 
             log.trace("started children threads");



Mime
View raw message