Author: toad
Date: 2008-06-13 12:20:09 +0000 (Fri, 13 Jun 2008)
New Revision: 20287
Modified:
branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
Log:
Pass in ClientContext in chooseKey (part 2, add it everywhere)
Modified:
branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2008-06-13 12:16:58 UTC (rev 20286)
+++ branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2008-06-13 12:20:09 UTC (rev 20287)
@@ -46,7 +46,7 @@
return keys;
}
- public Object chooseKey(KeysFetchingLocally fetching, ObjectContainer
container) {
+ public Object chooseKey(KeysFetchingLocally fetching, ObjectContainer
container, ClientContext context) {
if(fetching.hasKey(key.getNodeKey())) return null;
return keys[0];
}
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-06-13 12:16:58 UTC (rev 20286)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-06-13 12:20:09 UTC (rev 20287)
@@ -348,7 +348,7 @@
else if(PRIORITY_HARD.equals(choosenPriorityScheduler))
fuzz = 0;
// schedCore juggles both
- return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, false, (short) -1, -1);
+ return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, false, (short) -1, -1, clientContext);
}
public ChosenRequest getBetterNonPersistentRequest(ChosenRequest req) {
@@ -358,10 +358,10 @@
else if(PRIORITY_HARD.equals(choosenPriorityScheduler))
fuzz = 0;
if(req == null)
- return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, true, (short) -1, -1);
+ return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, true, (short) -1, -1, clientContext);
short prio = req.request.getPriorityClass();
int retryCount = req.request.getRetryCount();
- return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, true, prio, retryCount);
+ return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, true, prio, retryCount, clientContext);
}
private static final int MAX_STARTER_QUEUE_SIZE = 10;
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-06-13 12:16:58 UTC (rev 20286)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-06-13 12:20:09 UTC (rev 20287)
@@ -177,9 +177,9 @@
// We prevent a number of race conditions (e.g. adding a retry count
and then another
// thread removes it cos its empty) ... and in addToGrabArray etc we
already sync on this.
// 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,
short maxPrio, int retryCount) {
+ ChosenRequest removeFirst(int fuzz, RandomSource random,
OfferedKeysList[] offeredKeys, RequestStarter starter,
ClientRequestSchedulerNonPersistent schedTransient, boolean transientOnly,
short maxPrio, int retryCount, ClientContext context) {
SendableRequest req = removeFirstInner(fuzz, random,
offeredKeys, starter, schedTransient, transientOnly, maxPrio, retryCount);
- Object token = req.chooseKey(this, req.persistent() ? container
: null);
+ Object token = req.chooseKey(this, req.persistent() ? container
: null, context);
if(token == null) {
return null;
} else {
Modified: branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
2008-06-13 12:16:58 UTC (rev 20286)
+++ branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
2008-06-13 12:20:09 UTC (rev 20287)
@@ -75,7 +75,7 @@
throw new UnsupportedOperationException();
}
- public synchronized Object chooseKey(KeysFetchingLocally fetching,
ObjectContainer container) {
+ public synchronized Object chooseKey(KeysFetchingLocally fetching,
ObjectContainer container, ClientContext context) {
assert(keysList.size() == keys.size());
if(keys.size() == 1) {
// Shortcut the common case
Modified:
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
2008-06-13 12:16:58 UTC (rev 20286)
+++
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
2008-06-13 12:20:09 UTC (rev 20287)
@@ -66,7 +66,7 @@
return ctx;
}
- public Object chooseKey(KeysFetchingLocally keys, ObjectContainer
container) {
+ public Object chooseKey(KeysFetchingLocally keys, ObjectContainer
container, ClientContext context) {
if(cancelled) return null;
return removeRandomBlockNum(keys);
}
Modified: branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
2008-06-13 12:16:58 UTC (rev 20286)
+++ branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
2008-06-13 12:20:09 UTC (rev 20287)
@@ -132,7 +132,7 @@
return new Object[] { new Integer(0) };
}
- public synchronized Object chooseKey(KeysFetchingLocally keys,
ObjectContainer container) {
+ public synchronized Object chooseKey(KeysFetchingLocally keys,
ObjectContainer container, ClientContext context) {
if(finished) return null;
else return new Integer(0);
}