You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2012/04/12 21:03:32 UTC

svn commit: r1325450 - /commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java

Author: markt
Date: Thu Apr 12 19:03:31 2012
New Revision: 1325450

URL: http://svn.apache.org/viewvc?rev=1325450&view=rev
Log:
Timing issues / GC pauses look like the most likely cause of problems with this test. Refactor the sleeps to allow much more time if required.

Modified:
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java?rev=1325450&r1=1325449&r2=1325450&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolClassLoaders.java Thu Apr 12 19:03:31 2012
@@ -42,7 +42,11 @@ public class TestGenericObjectPoolClassL
 			GenericObjectPool<URL> pool1 = new GenericObjectPool<URL>(factory1);
 			pool1.setMinIdle(1);
 			pool1.setTimeBetweenEvictionRunsMillis(100);
-			Thread.sleep(200);
+			int counter = 0;
+			while (counter < 50 && pool1.getNumIdle() != 1) {
+	            Thread.sleep(100);
+	            counter++;
+			}
 			assertEquals("Wrong number of idle objects in pool1", 1,
 			        pool1.getNumIdle());
 
@@ -60,8 +64,12 @@ public class TestGenericObjectPoolClassL
 			pool2.clear();
 
 			pool2.setTimeBetweenEvictionRunsMillis(100);
-			Thread.sleep(200);
-
+			
+            counter = 0;
+            while (counter < 50 && pool2.getNumIdle() != 1) {
+                Thread.sleep(100);
+                counter++;
+            }
 			assertEquals("Wrong number of  idle objects in pool2", 1,
 			        pool2.getNumIdle());