Hello,
*AsyncThread.AsyncThread* contains the following bit while consuming the
last remaining events in the queue after getting signaled for shutdown:
while (!queue.isEmpty()) {
try {
final LogEvent event = queue.take();
if (event instanceof Log4jLogEvent) {
final Log4jLogEvent logEvent = (Log4jLogEvent) event;
logEvent.setEndOfBatch(queue.isEmpty());
callAppenders(logEvent);
count++;
} else {
ignored++;
LOGGER.trace("Ignoring event of class {}",
event.getClass().getName());
}
Here two things are puzzling me:
1. Why do we still use a blocking poll, i.e., *queue.take()*, at this
termination stage? Why not simply use *queue.poll()* non-blocking
variant?
2. Why do we only accept *Log4jLogEvent*'s and ignore the rest?
I will appreciate it if you can share some hints.
Kind regards.