[freenet-cvs] r13656 - trunk/freenet/src/freenet/support/io

nextgens at freenetproject.org nextgens at freenetproject.org
Tue Jun 19 20:10:31 UTC 2007


Author: nextgens
Date: 2007-06-19 20:10:30 +0000 (Tue, 19 Jun 2007)
New Revision: 13656

Modified:
   trunk/freenet/src/freenet/support/io/FileBucketFactory.java
Log:
Maybe fix the evil NPE thrown on shutdown by the JVM... review is welcome; it might have side effects like breaking persistent storage :|

Modified: trunk/freenet/src/freenet/support/io/FileBucketFactory.java
===================================================================
--- trunk/freenet/src/freenet/support/io/FileBucketFactory.java	2007-06-19 18:37:48 UTC (rev 13655)
+++ trunk/freenet/src/freenet/support/io/FileBucketFactory.java	2007-06-19 20:10:30 UTC (rev 13656)
@@ -8,6 +8,8 @@
 import freenet.support.api.Bucket;
 import freenet.support.api.BucketFactory;
 
+import org.tanukisoftware.wrapper.WrapperManager;
+
 public class FileBucketFactory implements BucketFactory {
     
     private Vector files = new Vector();
@@ -20,6 +22,7 @@
     }
 
     public Bucket makeBucket(long size) throws IOException {
+	if(WrapperManager.hasShutdownHookBeenTriggered()) throw new IOException("Shutdown has been triggered; no new FileBucket will be created");
     	File f = File.createTempFile("bf_", ".freenet-tmp", rootDir);
         Bucket b = new FileBucket(f, false, true, true, false, true);
         files.addElement(f);




More information about the cvs mailing list