ivankelly commented on a change in pull request #727: Issue 693: add interface 
and implementation of LedgerEntries
URL: https://github.com/apache/bookkeeper/pull/727#discussion_r152628155
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/LedgerEntries.java
 ##########
 @@ -35,10 +35,15 @@
     LedgerEntry getEntry(long entryId);
 
     /**
-     * In this, It does not retain the ByteBuf references for the entries in 
this LedgerEntries.
+     * In this method, It does not increment the reference counts of ByteBuf 
for the entries in this LedgerEntries.
      * The caller who calls {@link #iterator()} should be careful for not 
releasing the references.
      *
-     * @return the iterator of type LedgerEntry
+     * when iterator is called, you are handing out the entries, you may not 
know when the caller will
 
 Review comment:
   The reference count that a LedgerEntry has before iterator() is called 
belongs to LedgerEntries, because that is referring to the fact that 
LedgerEntries own those objects.
   
   With retainedIterator there is two options. a) the ownership of the 
reference is moved to the Iterator (like move semantics in c++) or b) a new 
Iterator object with a new reference count on the LedgerEntry is created.
   
   a) is a move, b) is a copy (albeit shallow).
   
   If retainedIterator is part of the API I would prefer the a) semantic, but 
this would imply that retainedIterator can only be called once. If it's b) I 
would prefer it be done with a Utility method. 
   
   And if retainedIterator is kept, rename it to retainingIterator. It should 
be an adjective.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to