lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1220705 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestWeakIdentityMap.java
Date Mon, 19 Dec 2011 12:14:51 GMT
Author: uschindler
Date: Mon Dec 19 12:14:50 2011
New Revision: 1220705

URL: http://svn.apache.org/viewvc?rev=1220705&view=rev
Log:
LUCENE-3653: Remove extra useless thread in weak CHM test

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestWeakIdentityMap.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestWeakIdentityMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestWeakIdentityMap.java?rev=1220705&r1=1220704&r2=1220705&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestWeakIdentityMap.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestWeakIdentityMap.java Mon Dec
19 12:14:50 2011
@@ -19,7 +19,6 @@ package org.apache.lucene.util;
 
 import java.util.Map;
 import java.util.Random;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ExecutorService;
@@ -115,7 +114,7 @@ public class TestWeakIdentityMap extends
 
   public void testConcurrentHashMap() throws Exception {
     final int threadCount = atLeast(32), keyCount = atLeast(1024);
-    final ExecutorService exec = Executors.newFixedThreadPool(threadCount + 1);
+    final ExecutorService exec = Executors.newFixedThreadPool(threadCount);
     final WeakIdentityMap<Object,Integer> map =
       WeakIdentityMap.newConcurrentHashMap();
     // we keep strong references to the keys,
@@ -126,7 +125,6 @@ public class TestWeakIdentityMap extends
     }
     
     try {
-      final AtomicInteger running = new AtomicInteger(threadCount);
       for (int t = 0; t < threadCount; t++) {
         final Random rnd = new Random(random.nextLong());
         final int count = atLeast(rnd, 20000);
@@ -155,20 +153,9 @@ public class TestWeakIdentityMap extends
                   fail("Should not get here.");
               }
             }
-            running.decrementAndGet();
           }
         });
       }
-      exec.execute(new Runnable() {
-        public void run() {
-          // check that GC does not cause problems in reap() method:
-          while (running.get() > 0) {
-            System.runFinalization();
-            System.gc();
-            map.isEmpty(); // simple access
-          }
-        }
-      });
     } finally {
       exec.shutdown();
       while (!exec.awaitTermination(1000L, TimeUnit.MILLISECONDS));



Mime
View raw message