This is an automated email from the ASF dual-hosted git repository.
ddiederen pushed a commit to branch branch-3.7
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/branch-3.7 by this push:
new ddecda5 ZOOKEEPER-4204: Remove unnecessary creation of thousands of
thread in…
ddecda5 is described below
commit ddecda522df8d39407cd5782dbe7778221cb8bd1
Author: Amichai Rothman <[email protected]>
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 <[email protected]>
Reviewers: Michael Han <[email protected]>, Damien Diederen
<[email protected]>
Closes #1598 from amichair/ZOOKEEPER-4204
(cherry picked from commit 7a368b4b196af02190e6e57f18f56598ee32a626)
Signed-off-by: Damien Diederen <[email protected]>
---
.../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