Author: toad
Date: 2008-07-17 14:13:30 +0000 (Thu, 17 Jul 2008)
New Revision: 21169
Modified:
branches/db4o/freenet/.classpath
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
branches/db4o/freenet/src/freenet/node/RequestScheduler.java
branches/db4o/freenet/src/freenet/node/RequestStarter.java
branches/db4o/freenet/src/freenet/node/SendableGet.java
Log:
Separate removing the key from keysFetching from removing the
persistentchosenrequest.
Always remove the key in the finally{} block.
Modified: branches/db4o/freenet/.classpath
===================================================================
--- branches/db4o/freenet/.classpath 2008-07-17 13:38:25 UTC (rev 21168)
+++ branches/db4o/freenet/.classpath 2008-07-17 14:13:30 UTC (rev 21169)
@@ -5,6 +5,6 @@
<classpathentry exported="true" kind="lib" path="lib/freenet-ext.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/usr/share/java/junit.jar"/>
- <classpathentry kind="lib" path="lib/db4o-6.4.38.10595-java1.2.jar"/>
+ <classpathentry kind="lib" path="lib/db4o-6.4.48.10991-java1.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-07-17 13:38:25 UTC (rev 21168)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-07-17 14:13:30 UTC (rev 21169)
@@ -880,9 +880,13 @@
return schedCore;
}
- public void removeFetchingKey(Key key, ChosenRequest req) {
- schedCore.removeFetchingKey(key, req);
+ public void removeFetchingKey(Key key) {
+ schedCore.removeFetchingKey(key);
}
+
+ public void removeChosenRequest(ChosenRequest req) {
+ schedCore.removeChosenRequest(req);
+ }
public void callFailure(final SendableGet get, final
LowLevelGetException e, final Object keyNum, int prio, final ChosenRequest req,
boolean persistent) {
if(!persistent) {
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-07-17 13:38:25 UTC (rev 21168)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-07-17 14:13:30 UTC (rev 21169)
@@ -675,12 +675,15 @@
}
}
- public void removeFetchingKey(final Key key, final ChosenRequest req) {
+ public void removeFetchingKey(final Key key) {
if(key != null) {
- synchronized(keysFetching) {
- keysFetching.remove(key);
+ synchronized(keysFetching) {
+ keysFetching.remove(key);
+ }
}
- }
+ }
+
+ public void removeChosenRequest(final ChosenRequest req) {
int prio = NativeThread.NORM_PRIORITY+1;
assert(prio < ClientRequestScheduler.TRIP_PENDING_PRIORITY);
if(req != null && req.isPersistent()) {
Modified: branches/db4o/freenet/src/freenet/node/RequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/RequestScheduler.java
2008-07-17 13:38:25 UTC (rev 21168)
+++ branches/db4o/freenet/src/freenet/node/RequestScheduler.java
2008-07-17 14:13:30 UTC (rev 21169)
@@ -54,7 +54,9 @@
public KeysFetchingLocally fetchingKeys();
- public void removeFetchingKey(Key key, ChosenRequest req);
+ public void removeFetchingKey(Key key);
+
+ public void removeChosenRequest(ChosenRequest req);
/** Call onFailure() on the database thread, then delete the
PersistentChosenRequest. For a non-persistent request,
* just call onFailure() immediately. */
Modified: branches/db4o/freenet/src/freenet/node/RequestStarter.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/RequestStarter.java 2008-07-17
13:38:25 UTC (rev 21168)
+++ branches/db4o/freenet/src/freenet/node/RequestStarter.java 2008-07-17
14:13:30 UTC (rev 21169)
@@ -234,7 +234,8 @@
private boolean startRequest(ChosenRequest req, boolean logMINOR) {
if((!req.isPersistent()) && req.request.isCancelled(null)) {
- sched.removeFetchingKey(req.key, req);
+ sched.removeFetchingKey(req.key);
+ sched.removeChosenRequest(req);
return false;
}
if(logMINOR) Logger.minor(this, "Running request "+req+"
priority "+req.prio);
@@ -278,9 +279,11 @@
Logger.minor(this, "Finished "+req);
} catch (Throwable t) {
// Remove it if something is thrown.
- // But normally send() will remove it.
+ // But normally send(), callFailure() or
callSuccess() will remove it.
Logger.error(this, "Caught "+t, t);
- sched.removeFetchingKey(key, req);
+ sched.removeChosenRequest(req);
+ } finally {
+ sched.removeFetchingKey(key);
}
}
Modified: branches/db4o/freenet/src/freenet/node/SendableGet.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableGet.java 2008-07-17
13:38:25 UTC (rev 21168)
+++ branches/db4o/freenet/src/freenet/node/SendableGet.java 2008-07-17
14:13:30 UTC (rev 21169)
@@ -92,7 +92,7 @@
}
// We must remove the request even in this case.
// On other paths, callFailure() will do the removal.
- sched.removeFetchingKey(key.getNodeKey(), req);
+ sched.removeChosenRequest(req);
// Don't call onSuccess(), it will be called for us by
backdoor coalescing.
sched.succeeded(this, req);