I'm debugging my code and I see my thread is being blocked in the following log4j TextEncoderHelper. I'm using log4j 2.8.2
None of my threads was able to run and it basically blocked the whole application.
Does anyone know what the below does? If I have two threads logging, does it mean its deadlock?
(I'm running with parameter
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -DAsyncLogger.RingBufferSize=32768*32768 -DAsyncLogger.WaitStrategy=Sleep -Dlog4j2.AsyncQueueFullPolicy=Discard)
private static void copyDataToDestination(final ByteBuffer temp, final ByteBufferDestination destination) {
61 synchronized (destination) {
62 ByteBuffer destinationBuffer = destination.getByteBuffer();
63 if (destinationBuffer != temp) { // still need to write to the destination
64 temp.flip();
65 if (temp.remaining() > destinationBuffer.remaining()) {
66 destinationBuffer = destination.drain(destinationBuffer);
67 }
68 destinationBuffer.put(temp);
69 temp.clear();
70 }
71 }
72 }