shoothzj commented on code in PR #4340:
URL: https://github.com/apache/bookkeeper/pull/4340#discussion_r1590553534


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/JournalChannel.java:
##########
@@ -299,6 +298,8 @@ int read(ByteBuffer dst)
     public void close() throws IOException {
         if (bc != null) {
             bc.close();
+        } else if (fc != null) {

Review Comment:
   @eolivelli bc.close will close the ubder FileChannel, we can avoid one call 
to `close()`.
   
   BufferChannel will close the FileChannel
   
   
https://github.com/apache/bookkeeper/blob/b38b1717a7431d35f30439d2f47e4751be342357/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java#L100-L105
   
   FileChannel's close in jdk17
   ```
   public final void close() throws IOException {
           synchronized (closeLock) {
               if (closed)
                   return;
               closed = true;
               implCloseChannel();
           }
       }
   ```



-- 
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-unsubscr...@bookkeeper.apache.org

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

Reply via email to