DBZ-5272 Notify all threads in case of mutliple writers

This commit is contained in:
Jiri Pechanec 2022-06-20 13:55:04 +02:00
parent e5935d3540
commit 5e1ae24e92

View File

@ -199,7 +199,7 @@ protected void doEnqueue(T record) throws InterruptedException {
synchronized (this) {
while (queue.size() >= maxQueueSize || (maxQueueSizeInBytes > 0 && currentQueueSizeInBytes >= maxQueueSizeInBytes)) {
// notify poll() to drain queue
this.notify();
this.notifyAll();
// queue size or queue sizeInBytes threshold reached, so wait a bit
this.wait(pollInterval.toMillis());
}
@ -214,7 +214,7 @@ protected void doEnqueue(T record) throws InterruptedException {
if (queue.size() >= maxBatchSize || (maxQueueSizeInBytes > 0 && currentQueueSizeInBytes >= maxQueueSizeInBytes)) {
// notify poll() to start draining queue and do not wait
this.notify();
this.notifyAll();
}
}
}