lifepuzzlefun commented on code in PR #20814:
URL: https://github.com/apache/pulsar/pull/20814#discussion_r1285371568


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -190,6 +190,11 @@ public class ManagedLedgerImpl implements ManagedLedger, 
CreateCallback {
     @SuppressWarnings("unused")
     private volatile long totalSize = 0;
 
+    static final AtomicLongFieldUpdater<ManagedLedgerImpl> 
LAZY_RECOVERY_IN_PROCESS = AtomicLongFieldUpdater
+            .newUpdater(ManagedLedgerImpl.class, "lazyRecoveryInProcess");
+    @SuppressWarnings("unused")
+    private volatile long lazyRecoveryInProcess = 0;

Review Comment:
   Thanks for review, I agree with you. The idea to use this variable here is 
to avoid get the synchronized lock of the managedledger instance. current 
uninitializedCursors is not thread safe. so each time a call to get 
synchronized lock is needed.  I submit another to make this map thread safe. 
https://github.com/apache/pulsar/pull/20674. Need some guide to handle this. If 
acquire synchronized lock is acceptable. I will change the code in this style.



-- 
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]

Reply via email to