You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2010/03/12 23:48:58 UTC

svn commit: r922445 - /db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/query/api/QueryCancel.java

Author: mbo
Date: Fri Mar 12 22:48:58 2010
New Revision: 922445

URL: http://svn.apache.org/viewvc?rev=922445&view=rev
Log:
JDO-623: Add Thread.sleep to main thread 

Modified:
    db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/query/api/QueryCancel.java

Modified: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/query/api/QueryCancel.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/query/api/QueryCancel.java?rev=922445&r1=922444&r2=922445&view=diff
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/query/api/QueryCancel.java (original)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/query/api/QueryCancel.java Fri Mar 12 22:48:58 2010
@@ -49,6 +49,9 @@ supporting cancel) then JDOUnsupportedOp
 
 public class QueryCancel extends QueryTest {
 
+    /** Time for the main thread to sleep after starting a parallel thread. */
+    private static int MAIN_SLEEP_MILLIS = 1000;
+
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.1-8 (QueryCancel) failed: ";
@@ -82,6 +85,9 @@ public class QueryCancel extends QueryTe
         Thread t = new Thread(group, runnable, "Query Executor");
         t.start();
 
+        // Wait for a second such that the other thread can execute the query
+        Thread.sleep(MAIN_SLEEP_MILLIS);
+
         try {
             // cancel query 
             query.cancel(t);
@@ -121,6 +127,9 @@ public class QueryCancel extends QueryTe
         Thread t = new Thread(group, runnable, "Query Executor");
         t.start();
 
+        // Wait for a second such that the other thread can execute the query
+        Thread.sleep(MAIN_SLEEP_MILLIS);
+
         try {
             // cancel query 
             query.cancelAll();