You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/07/01 13:20:24 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #7409: Fix batch ackset recycled multiple times.

codelipenghui commented on a change in pull request #7409:
URL: https://github.com/apache/pulsar/pull/7409#discussion_r448357625



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/BitSetRecyclable.java
##########
@@ -1197,11 +1199,13 @@ private BitSetRecyclable(Handle<BitSetRecyclable> recyclerHandle) {
     }
 
     public static BitSetRecyclable create() {
-        return RECYCLER.get();
+        BitSetRecyclable instance = RECYCLER.get();
+        instance.recycled.set(false);
+        return instance;
     }
 
     public void recycle() {
-        if (recyclerHandle != null) {
+        if (recyclerHandle != null && recycled.compareAndSet(false, true)) {

Review comment:
       Make sense. Thanks.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org