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

sijie pushed a commit to branch branch-4.9
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.9 by this push:
     new 9d9342f  ISSUE #2023: change cached thread pool to fixed thread pool
9d9342f is described below

commit 9d9342f7641f13771755b5836b3d5343c98bc087
Author: bd2019us <[email protected]>
AuthorDate: Tue Apr 2 13:35:23 2019 -0500

    ISSUE #2023: change cached thread pool to fixed thread pool
    
    Descriptions of the changes in this PR:
    
    change newCachedThreadPool() to newFixedThreadPool(int)
    
    ### Motivation
    
    newFixedThreadPool(int) can be freely configured with the total number of 
threads, while cached thread pool may cause OutOfMemoryError when there are too 
many threads need to created.
    
    Reviewers: Enrico Olivelli <[email protected]>, Sijie Guo 
<[email protected]>
    
    This closes #2024 from bd2019us/patch, closes #2023
    
    (cherry picked from commit 0988e12c7a12e1ffae2cdbe932ba414ec06f40cc)
    Signed-off-by: Sijie Guo <[email protected]>
---
 .../main/java/org/apache/bookkeeper/tools/perf/table/PerfClient.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/tools/perf/src/main/java/org/apache/bookkeeper/tools/perf/table/PerfClient.java
 
b/tools/perf/src/main/java/org/apache/bookkeeper/tools/perf/table/PerfClient.java
index 4b34427..835f816 100644
--- 
a/tools/perf/src/main/java/org/apache/bookkeeper/tools/perf/table/PerfClient.java
+++ 
b/tools/perf/src/main/java/org/apache/bookkeeper/tools/perf/table/PerfClient.java
@@ -324,7 +324,7 @@ public class PerfClient implements Runnable {
 
                     final CountDownLatch latch = new 
CountDownLatch(tasks.size());
                     @Cleanup("shutdown")
-                    ExecutorService executor = Executors.newCachedThreadPool();
+                    ExecutorService executor = 
Executors.newFixedThreadPool(tasks.size());
                     for (BenchmarkTask task : tasks) {
                         executor.submit(() -> {
                             try {

Reply via email to