sijie closed pull request #1735: Issue 1703: IllegalReferenceCountException at 
closing EntryLogManagerForSingleEntryLog
URL: https://github.com/apache/bookkeeper/pull/1735
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
index b2dd4be605..633c5400da 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
@@ -63,6 +63,8 @@
      */
     protected final AtomicLong unpersistedBytes;
 
+    private boolean closed = false;
+
     // make constructor to be public for unit test
     public BufferedChannel(FileChannel fc, int capacity) throws IOException {
         // Use the same capacity for read and write buffers.
@@ -88,8 +90,12 @@ public BufferedChannel(FileChannel fc, int writeCapacity, 
int readCapacity, long
 
     @Override
     public synchronized void close() throws IOException {
+        if (closed) {
+            return;
+        }
         ReferenceCountUtil.safeRelease(writeBuffer);
         fileChannel.close();
+        closed = true;
     }
 
     /**


 

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