You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ck...@apache.org on 2019/12/07 22:55:15 UTC
[logging-log4j2] branch release-2.x updated: LOG4J2-2725 - Added
try/finally around event.execute() for RingBufferLogEventHandler to clear
memory correctly in case of exception/error (#316)
This is an automated email from the ASF dual-hosted git repository.
ckozak pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/release-2.x by this push:
new 61c661f LOG4J2-2725 - Added try/finally around event.execute() for RingBufferLogEventHandler to clear memory correctly in case of exception/error (#316)
61c661f is described below
commit 61c661fd13ffc607a0066edfc8ab2ae7acc916d1
Author: anikosss <an...@gmail.com>
AuthorDate: Sun Dec 8 01:55:05 2019 +0300
LOG4J2-2725 - Added try/finally around event.execute() for RingBufferLogEventHandler to clear memory correctly in case of exception/error (#316)
---
.../log4j/core/async/RingBufferLogEventHandler.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEventHandler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEventHandler.java
index f0cab8d..dfec3e4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEventHandler.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEventHandler.java
@@ -42,12 +42,16 @@ public class RingBufferLogEventHandler implements
@Override
public void onEvent(final RingBufferLogEvent event, final long sequence,
final boolean endOfBatch) throws Exception {
- event.execute(endOfBatch);
- event.clear();
- // notify the BatchEventProcessor that the sequence has progressed.
- // Without this callback the sequence would not be progressed
- // until the batch has completely finished.
- notifyCallback(sequence);
+ try {
+ event.execute(endOfBatch);
+ }
+ finally {
+ event.clear();
+ // notify the BatchEventProcessor that the sequence has progressed.
+ // Without this callback the sequence would not be progressed
+ // until the batch has completely finished.
+ notifyCallback(sequence);
+ }
}
private void notifyCallback(long sequence) {