Skip to content

Commit 50ceb1b

Browse files
committed
Avoid busy loop on client shutdown
1 parent 6815e2a commit 50ceb1b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/com/timgroup/statsd/StatsDProcessor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ protected void processLoop() {
9191
closeSignal.countDown();
9292
clientClosed = true;
9393
}
94+
if (clientClosed) {
95+
// We are draining highPrioMessages, which is a non-blocking
96+
// queue. Avoid a busy loop if the queue is empty while the aggregator
97+
// is flushing.
98+
Thread.sleep(WAIT_SLEEP_MS);
99+
}
94100
continue;
95101
}
96102

0 commit comments

Comments
 (0)