Author: j16sdiz
Date: 2008-05-01 05:27:12 +0000 (Thu, 01 May 2008)
New Revision: 19641

Modified:
   trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
slient datastore shutdown


Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-04-30 
23:08:13 UTC (rev 19640)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2008-05-01 
05:27:12 UTC (rev 19641)
@@ -5,6 +5,7 @@
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -1353,6 +1354,10 @@
                                hits++;
                        }
                        return block;
+               } catch (ClosedChannelException cce) {
+                       // The channel is already close
+                       Logger.debug(this, "channel closed" , cce);
+                       return null;
                } catch(Throwable ex) {  // FIXME: ugly
                        if(ex instanceof IOException) {
                                synchronized(this) {
@@ -1526,7 +1531,9 @@
                                Logger.minor(this, "Headers: "+header.length+" 
bytes, hash "+Fields.hashCode(header));
                                Logger.minor(this, "Data: "+data.length+" 
bytes, hash "+Fields.hashCode(data)+" putting "+HexUtil.bytesToHex(routingkey));
                        }
-                               
+               } catch (ClosedChannelException cce) {
+                       // The channel is already close
+                       Logger.debug(this, "channel closed", cce);
                } catch(Throwable ex) {  // FIXME: ugly
                        if(ex instanceof IOException) {
                                synchronized(this) {


Reply via email to