summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-01-16 11:27:24 +0100
committerSimon Rettberg2019-01-16 11:27:24 +0100
commit4348f12c6d56e94148dde7cac911275f4584b11c (patch)
tree08e633f0562bc0a3b4355dfc7c7536d81a771a58
parentDiskImage: Proper qcow2 detection (diff)
downloadmaster-sync-shared-4348f12c6d56e94148dde7cac911275f4584b11c.tar.gz
master-sync-shared-4348f12c6d56e94148dde7cac911275f4584b11c.tar.xz
master-sync-shared-4348f12c6d56e94148dde7cac911275f4584b11c.zip
[HashChecker] Fix unlimited spawning of check threads
Stupid variable mixup resulted in endless spawning of new checker threads that wouldn't go away after they're done.
-rw-r--r--src/main/java/org/openslx/filetransfer/util/HashChecker.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/openslx/filetransfer/util/HashChecker.java b/src/main/java/org/openslx/filetransfer/util/HashChecker.java
index bddf829..f6b27f7 100644
--- a/src/main/java/org/openslx/filetransfer/util/HashChecker.java
+++ b/src/main/java/org/openslx/filetransfer/util/HashChecker.java
@@ -106,7 +106,8 @@ public class HashChecker
execCallback( task, HashResult.FAILURE );
return true;
}
- if ( queue.isEmpty() ) {
+ if ( threads.isEmpty() ) {
+ // This is the first thread -- keep it around
CheckThread thread;
try {
thread = new CheckThread( false );
@@ -120,6 +121,7 @@ public class HashChecker
}
}
if ( queue.remainingCapacity() <= 1 && threads.size() < Runtime.getRuntime().availableProcessors() ) {
+ // Queue starts to fill up -- add more temporary threads
try {
CheckThread thread = new CheckThread( true );
thread.start();