Index: trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java =================================================================== --- trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java (revision 506832) +++ trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassLoaderTest.java (working copy) @@ -30,6 +30,8 @@ public class ClassLoaderTest extends TestCase { + public static volatile int flag; + /** * Tests that Classloader.defineClass() assigns appropriate * default domains to the defined classes. @@ -92,8 +94,10 @@ protected Class findClass(String name) throws ClassNotFoundException { try { - synchronized (lock) { - lock.wait(); + while (flag != 2) { + synchronized (lock) { + lock.wait(); + } } } catch (InterruptedException ie) {} @@ -137,6 +141,7 @@ SyncTestClassLoader cl = new SyncTestClassLoader(lock); SyncLoadTestThread tt1 = new SyncLoadTestThread(cl); SyncLoadTestThread tt2 = new SyncLoadTestThread(cl); + flag = 1; tt1.start(); tt2.start(); @@ -144,6 +149,7 @@ Thread.sleep(100); } + flag = 2; synchronized (lock) { lock.notifyAll(); }