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 2022/07/06 02:27:47 UTC

[GitHub] [pulsar] BewareMyPower commented on a diff in pull request #16399: [improve][broker] Recycle OpReadEntry in some corner cases

BewareMyPower commented on code in PR #16399:
URL: https://github.com/apache/pulsar/pull/16399#discussion_r914357537


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpReadEntry.java:
##########
@@ -48,6 +53,9 @@ class OpReadEntry implements ReadEntriesCallback {
     public static OpReadEntry create(ManagedCursorImpl cursor, PositionImpl readPositionRef, int count,
             ReadEntriesCallback callback, Object ctx, PositionImpl maxPosition) {
         OpReadEntry op = RECYCLER.get();
+        if (createCount != null) {

Review Comment:
   I just removed the `volatile` instead. In non-testing cases, these two variables are always null and never changed and we don't have to guarantee the visibility. Now, the overhead is just a conditional check on normal variables, just like `if (log.isDebugEnabled())` in other places.



-- 
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: commits-unsubscribe@pulsar.apache.org

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