szetszwo commented on code in PR #1049:
URL: https://github.com/apache/ratis/pull/1049#discussion_r1530726087


##########
ratis-server-api/src/main/java/org/apache/ratis/server/raftlog/RaftLog.java:
##########
@@ -79,6 +80,10 @@ default ReferenceCountedObject<LogEntryProto> retainLog(long 
index) throws RaftL
   /**
    * @return null if the log entry is not found in this log;
    *         otherwise, return the {@link EntryWithData} corresponding to the 
given index.
+   *         The {@link EntryWithData} enclosed retained underlying resource. 
The client code need to ensure either
+   *         calling {@link ReferenceCountedObject#release()} on the result of
+   *         {@link EntryWithData#getEntryRef(TimeDuration)} or {@link 
EntryWithData#release()} if the entry
+   *         is discarded.

Review Comment:
   > ...  it's convenient that EntryWithData returns the ReferenceCountedObject 
itself  ...
   
   However, it is incompatible.
   
   Also, if we add a new `release()` method to `EntryWithData`.  It becomes a 
different kind of `ReferenceCountedObject`. It becomes inconvenient (e.g. if we 
have some library code to release`ReferenceCountedObject`, it won't work for 
the new `EntryWithData` class.)



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