eolivelli commented on a change in pull request #1574: Disallow direct access 
to LedgerHandle#metadata
URL: https://github.com/apache/bookkeeper/pull/1574#discussion_r206492237
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ReadLastConfirmedOp.java
 ##########
 @@ -52,22 +52,22 @@ public ReadLastConfirmedOp(LedgerHandle lh, 
LastConfirmedDataCallback cb) {
         this.cb = cb;
         this.maxRecoveredData = new 
RecoveryData(LedgerHandle.INVALID_ENTRY_ID, 0);
         this.lh = lh;
-        this.numResponsesPending = lh.metadata.getEnsembleSize();
+        this.numResponsesPending = lh.getLedgerMetadata().getEnsembleSize();
         this.coverageSet = lh.distributionSchedule.getCoverageSet();
     }
 
     public void initiate() {
-        for (int i = 0; i < lh.metadata.currentEnsemble.size(); i++) {
-            
lh.bk.getBookieClient().readEntry(lh.metadata.currentEnsemble.get(i),
+        for (int i = 0; i < lh.getLedgerMetadata().currentEnsemble.size(); 
i++) {
+            
lh.bk.getBookieClient().readEntry(lh.getLedgerMetadata().currentEnsemble.get(i),
 
 Review comment:
   isn't it better to "campture" lh.getLedgerMetadata() once ?
   maybe it is guaranteed somewhere else that calling getLedgerMetadata twice 
will return exactly the same object because we are using safeOrderedExecutor, 
but it is not very clear just by reading this code

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to