diff options
author | Simon Rettberg | 2024-05-22 16:51:06 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-05-22 16:51:06 +0200 |
commit | 18e9d5521c17b5d2f9876088950f10884855a21d (patch) | |
tree | 946b7308a6e11a254a51d15da60c936b5ca33fe4 /dozentenmodul | |
parent | [server] CoW: Fix calculating copy speed, don't return delay=0 (diff) | |
download | tutor-module-18e9d5521c17b5d2f9876088950f10884855a21d.tar.gz tutor-module-18e9d5521c17b5d2f9876088950f10884855a21d.tar.xz tutor-module-18e9d5521c17b5d2f9876088950f10884855a21d.zip |
[*] Switch to new CascadedThreadPool
Diffstat (limited to 'dozentenmodul')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/AsyncHashGenerator.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/AsyncHashGenerator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/AsyncHashGenerator.java index 07efc449..479e634d 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/AsyncHashGenerator.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/AsyncHashGenerator.java @@ -9,7 +9,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -21,7 +20,7 @@ import org.openslx.bwlp.thrift.iface.TInvalidTokenException; import org.openslx.dozmod.thrift.Session; import org.openslx.filetransfer.util.FileChunk; import org.openslx.thrifthelper.ThriftManager; -import org.openslx.util.GrowingThreadPoolExecutor; +import org.openslx.util.CascadedThreadPoolExecutor; import org.openslx.util.PrioThreadFactory; import org.openslx.util.Util; @@ -29,10 +28,12 @@ public class AsyncHashGenerator extends Thread { private static final Logger LOGGER = LogManager.getLogger(AsyncHashGenerator.class); - private static final ThreadPoolExecutor HASH_WORK_POOL = new GrowingThreadPoolExecutor(1, - Math.max(1, (int)Math.min(Runtime.getRuntime().availableProcessors() - 1, - Runtime.getRuntime().maxMemory() / (FileChunk.CHUNK_SIZE * 3))), - 10, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(1), + private static final ThreadPoolExecutor HASH_WORK_POOL = new CascadedThreadPoolExecutor(1, + Math.max(1, (int)Math.min( + Runtime.getRuntime().availableProcessors() - 1, + Runtime.getRuntime().maxMemory() / (FileChunk.CHUNK_SIZE * 3) + )), + 10, TimeUnit.SECONDS, 3, new PrioThreadFactory("HashGen"), new ThreadPoolExecutor.CallerRunsPolicy()); private static final ThreadLocal<MessageDigest> SHA1_DIGESTER = new ThreadLocal<MessageDigest>() { |