Skip to content

Commit

Permalink
drain not take
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
  • Loading branch information
ceki committed Aug 19, 2021
1 parent bb57bee commit 2c9348a
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -17,7 +17,9 @@
import ch.qos.logback.core.spi.AppenderAttachableImpl;
import ch.qos.logback.core.util.InterruptUtil;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

Expand Down Expand Up @@ -287,11 +289,10 @@ public void run() {

// loop while the parent is started
while (parent.isStarted()) {
try {
E e = parent.blockingQueue.take();
aai.appendLoopOnAppenders(e);
} catch (InterruptedException ie) {
break;
List<E> elements = new ArrayList<E>();
parent.blockingQueue.drainTo(elements);
for(E e: elements) {
aai.appendLoopOnAppenders(e);
}
}

Expand Down

0 comments on commit 2c9348a

Please sign in to comment.