Author: toad
Date: 2009-02-20 20:47:33 +0000 (Fri, 20 Feb 2009)
New Revision: 25748
Modified:
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Activation. Paranoia/debugging wierd NPEs. Delete the failureException. If a
segment gets fetcherFinished() and hasn't started to decode, go straight to
remove from, because we will not get encoderFinished().
Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
2009-02-20 14:28:58 UTC (rev 25747)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
2009-02-20 20:47:33 UTC (rev 25748)
@@ -357,7 +357,7 @@
if(!s.succeeded()) {
throw new IllegalStateException("Not all
finished");
}
- s.throwError();
+ s.throwError(container);
// If still here, it succeeded
long sz = s.decodedLength(container);
finalLength += sz;
Modified:
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2009-02-20 14:28:58 UTC (rev 25747)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2009-02-20 20:47:33 UTC (rev 25748)
@@ -172,10 +172,13 @@
return isFinished(container) || finishing;
}
- /** Throw a FetchException, if we have one. Else do nothing. */
- public synchronized void throwError() throws FetchException {
- if(failureException != null)
+ /** Throw a FetchException, if we have one. Else do nothing.
+ * @param container */
+ public synchronized void throwError(ObjectContainer container) throws
FetchException {
+ if(failureException != null) {
+ if(persistent) container.activate(failureException, 5);
throw failureException;
+ }
}
/** Decoded length?
@@ -251,8 +254,10 @@
return -1;
}
dataRetries[blockNo] = 0; // Prevent healing of
successfully fetched block.
- if(persistent)
+ if(persistent) {
+ container.activate(dataKeys[blockNo], 5);
dataKeys[blockNo].removeFrom(container);
+ }
dataKeys[blockNo] = null;
if(persistent)
container.activate(dataBuckets[blockNo], 1);
@@ -273,8 +278,10 @@
return -1;
}
checkRetries[checkNo] = 0; // Prevent healing of
successfully fetched block.
- if(persistent)
+ if(persistent) {
+ container.activate(checkKeys[checkNo], 5);
checkKeys[checkNo].removeFrom(container);
+ }
checkKeys[checkNo] = null;
if(persistent)
container.activate(checkBuckets[checkNo], 1);
@@ -1285,7 +1292,7 @@
if(persistent)
container.activate(k, 5);
if(k.getRoutingKey() == null)
- throw new NullPointerException("Routing key is
null yet key exists for data block "+i+" of "+this);
+ throw new NullPointerException("Routing key is
null yet key exists for data block "+i+" of "+this+(persistent?("
stored="+container.ext().isStored(k)+" active="+container.ext().isActive(k)) :
""));
if(k.getNodeKey().equals(key)) return i;
else {
if(persistent)
@@ -1585,6 +1592,10 @@
}
container.activate(errors, 1);
errors.removeFrom(container);
+ if(failureException != null) {
+ container.activate(failureException, 5);
+ failureException.removeFrom(container);
+ }
container.delete(this);
}
@@ -1592,9 +1603,14 @@
synchronized(this) {
fetcherFinished = true;
if(!encoderFinished) {
- container.store(this);
- if(logMINOR) Logger.minor(this, "Fetcher
finished but encoder not finished on "+this);
- return;
+ if(!startedDecode) {
+ encoderFinished = true;
+ container.store(this);
+ } else {
+ container.store(this);
+ if(logMINOR) Logger.minor(this,
"Fetcher finished but encoder not finished on "+this);
+ return;
+ }
}
}
removeFrom(container, context);
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs