Skip to content

Commit

Permalink
[python] Sets rolloing batch threads as daemon thread
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu committed Dec 8, 2023
1 parent 9cd5a7e commit 9e98b2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class RollingBatch implements Runnable {
@Override
public void run() {
currentThread = Thread.currentThread();
currentThread.setDaemon(true);
while (!stop) {
int size;
Input batch = new Input();
Expand Down
8 changes: 7 additions & 1 deletion wlm/src/main/java/ai/djl/serving/wlm/WorkLoadManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ public class WorkLoadManager {

/** Constructs a {@link WorkLoadManager} instance. */
public WorkLoadManager() {
threadPool = Executors.newCachedThreadPool();
threadPool =
Executors.newCachedThreadPool(
r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
workerPools = new ConcurrentHashMap<>();
}

Expand Down

0 comments on commit 9e98b2b

Please sign in to comment.