You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by dd...@apache.org on 2021/07/28 13:31:23 UTC

[zookeeper] branch master updated: ZOOKEEPER-4204: Remove unnecessary creation of thousands of thread in…

This is an automated email from the ASF dual-hosted git repository.

ddiederen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a368b4  ZOOKEEPER-4204: Remove unnecessary creation of thousands of thread in…
7a368b4 is described below

commit 7a368b4b196af02190e6e57f18f56598ee32a626
Author: Amichai Rothman <am...@apache.org>
AuthorDate: Wed Jul 28 13:30:39 2021 +0000

    ZOOKEEPER-4204: Remove unnecessary creation of thousands of thread in…
    
    …stances to prevent RequestPathMetricsCollectorTest.testMultiThreadPerf occasional failures
    
    Author: Amichai Rothman <am...@apache.org>
    
    Reviewers: Michael Han <ha...@apache.org>, Damien Diederen <dd...@apache.org>
    
    Closes #1598 from amichair/ZOOKEEPER-4204
---
 .../server/util/RequestPathMetricsCollectorTest.java     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/server/util/RequestPathMetricsCollectorTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/server/util/RequestPathMetricsCollectorTest.java
index f31b13e..1c8c882 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/util/RequestPathMetricsCollectorTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/util/RequestPathMetricsCollectorTest.java
@@ -421,23 +421,23 @@ public class RequestPathMetricsCollectorTest {
         ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool();
         //call 100k get Data
         for (int i = 0; i < 100000; i++) {
-            executor.submit(new Thread(() -> requestPathMetricsCollector.registerRequest(getData, "/path1/path2/path"
-                                                                                                          + rand.nextInt(10))));
+            executor.submit(
+                () -> requestPathMetricsCollector.registerRequest(getData, "/path1/path2/path" + rand.nextInt(10)));
         }
         //5K create
         for (int i = 0; i < 5000; i++) {
-            executor.submit(new Thread(() -> requestPathMetricsCollector.registerRequest(create2, "/path1/path2/path"
-                                                                                                          + rand.nextInt(10))));
+            executor.submit(
+                () -> requestPathMetricsCollector.registerRequest(create2, "/path1/path2/path" + rand.nextInt(10)));
         }
         //5K delete
         for (int i = 0; i < 5000; i++) {
-            executor.submit(new Thread(() -> requestPathMetricsCollector.registerRequest(delete, "/path1/path2/path"
-                                                                                                         + rand.nextInt(10))));
+            executor.submit(
+                () -> requestPathMetricsCollector.registerRequest(delete, "/path1/path2/path" + rand.nextInt(10)));
         }
         //40K getChildren
         for (int i = 0; i < 40000; i++) {
-            executor.submit(new Thread(() -> requestPathMetricsCollector.registerRequest(getChildren, "/path1/path2/path"
-                                                                                                              + rand.nextInt(10))));
+            executor.submit(
+                () -> requestPathMetricsCollector.registerRequest(getChildren, "/path1/path2/path" + rand.nextInt(10)));
         }
         executor.shutdown();
         //wait for at most 10 mill seconds