diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-07-17 17:26:17 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-07-24 00:31:03 +0200 |
commit | 097f01bfb65dd8f7b3d562bbd1713ecf4be5675e (patch) | |
tree | 504b0cb068ff76e59ed88a5bb302fd5d163ddfc0 /org.eclipse.jgit/src | |
parent | d35f0ffb7c33a11f8192ec64da5a736827ab472d (diff) | |
download | jgit-097f01bfb65dd8f7b3d562bbd1713ecf4be5675e.tar.gz jgit-097f01bfb65dd8f7b3d562bbd1713ecf4be5675e.zip |
Use LinkedBlockingQueue for executor determining filesystem attributes
Using a fixed thread pool with unbounded LinkedBlockingQueue fixes the
RejectedExecutionException thrown if too many threads try to
concurrently determine filesystem attributes.
Comparing that to an alternative implementation using an unbounded
thread pool instead showed similar performance with the reproducer (in
range of 100-1000 threads in reproducer) on my mac:
threads time
fixed threadpool up to 5 threads with LinkedBlockingQueue of unlimited
queue size
100 1103 ms
200 1602 ms
300 2369 ms
500 4002 ms
1000 11071 ms
unbounded cached threadpool
100 1108 ms
200 1591 ms
300 2299 ms
500 4577 ms
1000 11196 ms
Bug: 564202
Change-Id: I773da7414a1dca8e548349442dca9b56643be946
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 91574efec4..50b77fec8e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -52,7 +52,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -235,7 +235,7 @@ public abstract class FS { * @see java.util.concurrent.Executors#newCachedThreadPool() */ private static final Executor FUTURE_RUNNER = new ThreadPoolExecutor(0, - 5, 30L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), + 5, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), runnable -> { Thread t = new Thread(runnable, "FileStoreAttributeReader-" //$NON-NLS-1$ + threadNumber.getAndIncrement()); |