This is an automated email from the ASF dual-hosted git repository.

yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit f3eadd6885d6d13526d555b008a11b20977cf291
Author: Yan Zhao <[email protected]>
AuthorDate: Fri Feb 3 10:34:41 2023 +0800

    Fix QueueEntry recycle problem. (#3747)
    
    Descriptions of the changes in this PR:
    In the QueueEntry recycle, it only recycles itself to the object pool, but 
didn't reset some properties.
    Like entry, cb, etc. We should reset the filed before recycles itself.
    
    (cherry picked from commit 901f76ce4c4f9f771363424dbb60da4d590ad122)
---
 .../src/main/java/org/apache/bookkeeper/bookie/Journal.java    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
index 62c07377d3..6105d00012 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
@@ -348,8 +348,8 @@ public class Journal extends BookieCriticalThread 
implements CheckpointSource {
             cbThreadPoolQueueSize.dec();
             
journalAddEntryStats.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueTime),
 TimeUnit.NANOSECONDS);
             cb.writeComplete(0, ledgerId, entryId, null, ctx);
-            recycle();
             callbackTime.add(MathUtils.elapsedNanos(startTime));
+            recycle();
         }
 
         private final Handle<QueueEntry> recyclerHandle;
@@ -366,6 +366,14 @@ public class Journal extends BookieCriticalThread 
implements CheckpointSource {
         };
 
         private void recycle() {
+            this.entry = null;
+            this.cb = null;
+            this.ctx = null;
+            this.journalAddEntryStats = null;
+            this.journalCbQueuedLatency = null;
+            this.journalCbQueueSize = null;
+            this.cbThreadPoolQueueSize = null;
+            this.callbackTime = null;
             recyclerHandle.recycle(this);
         }
     }

Reply via email to