diff options
author | Simon Rettberg | 2023-02-15 15:01:27 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-02-15 15:01:27 +0100 |
commit | 1f792b228707acd0f38ec5c924b672aae3fa8452 (patch) | |
tree | fd874c248904289e260d9a52c57815738e9726f6 /src | |
parent | [HttpRequest] Add task (diff) | |
download | tmlite-bwlp-1f792b228707acd0f38ec5c924b672aae3fa8452.tar.gz tmlite-bwlp-1f792b228707acd0f38ec5c924b672aae3fa8452.tar.xz tmlite-bwlp-1f792b228707acd0f38ec5c924b672aae3fa8452.zip |
[WakeOnLan] Fix thread leak from ThreadPool
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java index bd9693c..2d07db9 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java +++ b/src/main/java/org/openslx/taskmanager/tasks/WakeOnLan.java @@ -12,6 +12,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.util.Strings; import org.openslx.satserver.util.MessageSink; @@ -175,6 +176,12 @@ public class WakeOnLan extends AbstractTask } } } while ( true ); + tp.shutdown(); + try { + tp.awaitTermination( 10, TimeUnit.SECONDS ); + } catch ( InterruptedException e ) { + Thread.currentThread().interrupt(); + } status.addMsg( "Mainloop done" ); if ( this.clients.isEmpty() ) return true; |