zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1365869 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
Date Thu, 26 Jul 2012 02:32:50 GMT
Author: sijie
Date: Thu Jul 26 02:32:50 2012
New Revision: 1365869

URL: http://svn.apache.org/viewvc?rev=1365869&view=rev
Log:
BOOKKEEPER-349: Entry logger should close all the chennels which are there in Map, instead
of closing only current channel. (umamaheswararao via sijie)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1365869&r1=1365868&r2=1365869&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Thu Jul 26 02:32:50 2012
@@ -40,6 +40,8 @@ Trunk (unreleased changes)
 
 	BOOKKEEPER-327: System.currentTimeMillis usage in BookKeeper (uma via fpj)
 
+        BOOKKEEPER-349: Entry logger should close all the chennels which are there in Map,
instead of closing only current channel. (umamaheswararao via sijie)
+
       hedwig-client:
 
         BOOKKEEPER-274: Hedwig cpp client library should not link to cppunit which is just
used for test. (sijie via ivank)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java?rev=1365869&r1=1365868&r2=1365869&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
Thu Jul 26 02:32:50 2012
@@ -38,6 +38,7 @@ import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.slf4j.Logger;
@@ -468,13 +469,21 @@ public class EntryLogger {
         // since logChannel is buffered channel, do flush when shutting down
         try {
             flush();
-            logChannel.getFileChannel().close();
+            for (Entry<Long, BufferedChannel> channelEntry : channels
+                    .entrySet()) {
+                channelEntry.getValue().getFileChannel().close();
+            }
         } catch (IOException ie) {
             // we have no idea how to avoid io exception during shutting down, so just ignore
it
             LOG.error("Error flush entry log during shutting down, which may cause entry
log corrupted.", ie);
         } finally {
-            if (logChannel.getFileChannel().isOpen()) {
-                IOUtils.close(LOG, logChannel.getFileChannel());
+            for (Entry<Long, BufferedChannel> channelEntry : channels
+                    .entrySet()) {
+                FileChannel fileChannel = channelEntry.getValue()
+                        .getFileChannel();
+                if (fileChannel.isOpen()) {
+                    IOUtils.close(LOG, fileChannel);
+                }
             }
         }
     }



Mime
View raw message