BewareMyPower commented on code in PR #23833:
URL: https://github.com/apache/pulsar/pull/23833#discussion_r1909911380
##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/BitSetRecyclable.java:
##########
@@ -1211,6 +1211,9 @@ public void recycle() {
if (recyclerHandle != null) {
this.clear();
recyclerHandle.recycle(this);
+ // Reset with null so that recycle() can be called many times but
only the 1st time takes effect.
Review Comment:
I agree. I will use `BitSet` instead. Using a recyclable object is very
error-prone in non-trivial cases. In this specific case, it's used as the value
of a map and we must guarantee `recycle()` is called when the value is removed.
The benefit of recycler is a pre-mature optimization IMO.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]