Author: toad
Date: 2008-07-12 01:56:32 +0000 (Sat, 12 Jul 2008)
New Revision: 21088
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
Log:
Paranoia, try to track down wierd bug
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
2008-07-12 01:24:26 UTC (rev 21087)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
2008-07-12 01:56:32 UTC (rev 21088)
@@ -13,6 +13,7 @@
import freenet.keys.Key;
import freenet.node.BaseSendableGet;
import freenet.node.RequestStarter;
+import freenet.node.SendableGet;
import freenet.node.SendableRequest;
import freenet.support.Logger;
import freenet.support.SectoredRandomGrabArrayWithInt;
@@ -63,6 +64,8 @@
}
void innerRegister(SendableRequest req, RandomSource random,
ObjectContainer container) {
+ if(isInsertScheduler && req instanceof SendableGet)
+ throw new IllegalArgumentException("Adding a
SendableGet to an insert scheduler!!");
if(req.persistent() != persistent())
throw new IllegalArgumentException("innerRegister for
persistence="+req.persistent()+" but our persistence is "+persistent());
if(req.getPriorityClass(container) == 0) {
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-07-12 01:24:26 UTC (rev 21087)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-07-12 01:56:32 UTC (rev 21088)
@@ -86,6 +86,9 @@
core = (ClientRequestSchedulerCore) (results.next());
selectorContainer.activate(core, 2);
System.err.println("Loaded core...");
+ if(core.nodeDBHandle != nodeDBHandle) throw new
IllegalStateException("Wrong nodeDBHandle");
+ if(core.isInsertScheduler != forInserts) throw new
IllegalStateException("Wrong isInsertScheduler");
+ if(core.isSSKScheduler != forSSKs) throw new
IllegalStateException("Wrong forSSKs");
} else {
core = new ClientRequestSchedulerCore(node, forInserts,
forSSKs, selectorContainer, cooldownTime);
System.err.println("Created new core...");
@@ -243,6 +246,9 @@
// The worry is ... is there any nested locking outside of the
hierarchy?
ChosenRequest removeFirst(int fuzz, RandomSource random,
OfferedKeysList[] offeredKeys, RequestStarter starter,
ClientRequestSchedulerNonPersistent schedTransient, boolean transientOnly,
boolean notTransient, short maxPrio, int retryCount, ClientContext context,
ObjectContainer container) {
SendableRequest req = removeFirstInner(fuzz, random,
offeredKeys, starter, schedTransient, transientOnly, notTransient, maxPrio,
retryCount, context, container);
+ if(isInsertScheduler && req instanceof SendableGet) {
+ throw new IllegalStateException("removeFirstInner
returned a SendableGet on an insert scheduler!!");
+ }
return maybeMakeChosenRequest(req, container, context);
}
@@ -585,6 +591,9 @@
}
public boolean hasKey(Key key) {
+ if(keysFetching == null) {
+ throw new NullPointerException();
+ }
synchronized(keysFetching) {
return keysFetching.contains(key);
}