Author: zothar
Date: 2007-03-18 13:34:58 +0000 (Sun, 18 Mar 2007)
New Revision: 12202

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
   trunk/freenet/src/freenet/node/Node.java
Log:
OOMHandler added to ThrottlePersister and SplitFileFetcher finisher.  Throwable 
catching changes on ThrottlePersister.

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java        
2007-03-17 22:52:43 UTC (rev 12201)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java        
2007-03-18 13:34:58 UTC (rev 12202)
@@ -18,6 +18,7 @@
 import freenet.keys.ClientCHK;
 import freenet.support.Fields;
 import freenet.support.Logger;
+import freenet.support.OOMHandler;
 import freenet.support.api.Bucket;
 import freenet.support.compress.CompressionOutputSizeException;
 import freenet.support.compress.Compressor;
@@ -254,6 +255,10 @@
                        cb.onSuccess(new FetchResult(clientMetadata, data), 
this);
                } catch (FetchException e) {
                        cb.onFailure(e, this);
+               } catch (OutOfMemoryError e) {
+                       OOMHandler.handleOOM(e);
+                       System.err.println("Failing above attempted fetch...");
+                       cb.onFailure(new 
FetchException(FetchException.INTERNAL_ERROR, e), this);
                } catch (Throwable t) {
                        cb.onFailure(new 
FetchException(FetchException.INTERNAL_ERROR, t), this);
                }

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2007-03-17 22:52:43 UTC (rev 
12201)
+++ trunk/freenet/src/freenet/node/Node.java    2007-03-18 13:34:58 UTC (rev 
12202)
@@ -101,6 +101,7 @@
 import freenet.support.LRUHashtable;
 import freenet.support.LRUQueue;
 import freenet.support.Logger;
+import freenet.support.OOMHandler;
 import freenet.support.ShortBuffer;
 import freenet.support.SimpleFieldSet;
 import freenet.support.TimeUtil;
@@ -3501,8 +3502,14 @@
                        while(true) {
                                try {
                                        persistThrottle();
+                               } catch (OutOfMemoryError e) {
+                                       OOMHandler.handleOOM(e);
+                                       System.err.println("Will restart 
ThrottlePersister...");
                                } catch (Throwable t) {
-                                       Logger.error(this, "Caught "+t, t);
+                                       Logger.error(this, "Caught in 
ThrottlePersister: "+t, t);
+                                       System.err.println("Caught in 
ThrottlePersister: "+t);
+                                       t.printStackTrace();
+                                       System.err.println("Will restart 
ThrottlePersister...");
                                }
                                try {
                                        synchronized(this) {


Reply via email to