Author: toad
Date: 2008-06-26 18:41:43 +0000 (Thu, 26 Jun 2008)
New Revision: 20774
Modified:
branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
branches/db4o/freenet/src/freenet/node/RequestStarter.java
branches/db4o/freenet/src/freenet/node/SendableGet.java
Log:
Only check cancellation status if persistent
Modified: branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java
2008-06-26 18:36:48 UTC (rev 20773)
+++ branches/db4o/freenet/src/freenet/client/async/ChosenRequest.java
2008-06-26 18:41:43 UTC (rev 20774)
@@ -38,5 +38,9 @@
public boolean send(NodeClientCore core, RequestScheduler sched) {
return request.send(core, sched, this);
}
+
+ public boolean isPersistent() {
+ return this instanceof PersistentChosenRequest;
+ }
}
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-06-26 18:36:48 UTC (rev 20773)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-06-26 18:41:43 UTC (rev 20774)
@@ -346,6 +346,10 @@
if(!databaseExecutor.onThread()) {
throw new IllegalStateException("Not on
database thread!");
}
+ if(persistent)
+ selectorContainer.activate(req, 1);
+ if(logMINOR)
+ Logger.minor(this, "finishRegister()
for "+req);
if(anyValid)
schedCore.innerRegister(req, random,
selectorContainer);
selectorContainer.delete(reg);
@@ -356,6 +360,8 @@
public void run(ObjectContainer
container, ClientContext context) {
container.activate(req, 1);
+ if(logMINOR)
+ Logger.minor(this,
"finishRegister() for "+req);
if(anyValid)
schedCore.innerRegister(req, random, container);
container.delete(reg);
Modified: branches/db4o/freenet/src/freenet/node/RequestStarter.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/RequestStarter.java 2008-06-26
18:36:48 UTC (rev 20773)
+++ branches/db4o/freenet/src/freenet/node/RequestStarter.java 2008-06-26
18:41:43 UTC (rev 20774)
@@ -199,7 +199,7 @@
if(queue.isEmpty()) break;
req = (ChosenRequest) queue.removeFirst();
}
- if((!req.request.persistent) &&
req.request.isCancelled()) continue;
+ if((!req.isPersistent()) && req.request.isCancelled())
continue;
break;
}
ChosenRequest betterReq =
sched.getBetterNonPersistentRequest(req);
Modified: branches/db4o/freenet/src/freenet/node/SendableGet.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableGet.java 2008-06-26
18:36:48 UTC (rev 20773)
+++ branches/db4o/freenet/src/freenet/node/SendableGet.java 2008-06-26
18:41:43 UTC (rev 20774)
@@ -73,7 +73,7 @@
Logger.minor(this, "Sending get for key "+keyNum+" :
"+key);
FetchContext ctx = getContext();
boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
- if(isCancelled()) {
+ if((!req.isPersistent()) && isCancelled()) {
if(logMINOR) Logger.minor(this, "Cancelled: "+this);
// callbacks must initially run at HIGH_PRIORITY so
they are executed before we remove the key from the currently running list
sched.callFailure(this, new
LowLevelGetException(LowLevelGetException.CANCELLED), keyNum,
NativeThread.HIGH_PRIORITY, req);