summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/AsyncHashGenerator.java13
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>() {