From 4348f12c6d56e94148dde7cac911275f4584b11c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 16 Jan 2019 11:27:24 +0100 Subject: [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. --- src/main/java/org/openslx/filetransfer/util/HashChecker.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); -- cgit v1.2.3-55-g7522