Author: toad
Date: 2009-02-03 16:55:35 +0000 (Tue, 03 Feb 2009)
New Revision: 25494
Modified:
branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.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/SingleBlockInserter.java
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
branches/db4o/freenet/src/freenet/node/SendableRequest.java
branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
Log:
API change: getClient() needs an ObjectContainer.
Note that this does not change the stored objects, so does not clobber
node.db4o.
Modified:
branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2009-02-03 16:47:06 UTC (rev 25493)
+++ branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -180,7 +180,8 @@
}
@Override
- public RequestClient getClient() {
+ public RequestClient getClient(ObjectContainer container) {
+ if(persistent) container.activate(parent, 1);
return parent.getClient();
}
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
2009-02-03 16:47:06 UTC (rev 25493)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -101,7 +101,7 @@
short prio = req.getPriorityClass(container);
if(logMINOR) Logger.minor(this, "Still registering "+req+" at
prio "+prio+" retry "+retryCount+" for "+req.getClientRequest());
addToRequestsByClientRequest(req.getClientRequest(), req,
container);
- addToGrabArray(prio, retryCount, fixRetryCount(retryCount),
req.getClient(), req.getClientRequest(), req, random, container);
+ addToGrabArray(prio, retryCount, fixRetryCount(retryCount),
req.getClient(container), req.getClientRequest(), req, random, container);
if(logMINOR) Logger.minor(this, "Registered "+req+" on
prioclass="+prio+", retrycount="+retryCount);
if(persistent())
sched.maybeAddToStarterQueue(req, container,
maybeActive);
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2009-02-03 16:47:06 UTC (rev 25493)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -437,7 +437,7 @@
// maybe we should ask people to report that
error if seen
Logger.normal(this, "In wrong priority class:
"+req+" (req.prio="+req.getPriorityClass(container)+" but
chosen="+choosenPriorityClass+ ')');
// Remove it.
- SectoredRandomGrabArrayWithObject clientGrabber
= (SectoredRandomGrabArrayWithObject) chosenTracker.getGrabber(req.getClient());
+ SectoredRandomGrabArrayWithObject clientGrabber
= (SectoredRandomGrabArrayWithObject)
chosenTracker.getGrabber(req.getClient(container));
if(clientGrabber != null) {
if(chosenTracker.persistent())
container.activate(clientGrabber, 1);
@@ -448,7 +448,7 @@
// Okay, it's been removed
already. Cool.
}
} else {
- Logger.error(this, "Could not find
client grabber for client "+req.getClient()+" from "+chosenTracker);
+ Logger.error(this, "Could not find
client grabber for client "+req.getClient(container)+" from "+chosenTracker);
}
if(req.persistent())
innerRegister(req, random, container,
null);
@@ -498,7 +498,7 @@
// Now we have chosen a request.
if(logMINOR) Logger.minor(this, "removeFirst()
returning "+req+" ("+chosenTracker.getNumber()+", prio "+
- req.getPriorityClass(container)+",
retries "+req.getRetryCount()+", client "+req.getClient()+", client-req
"+req.getClientRequest()+ ')');
+ req.getPriorityClass(container)+",
retries "+req.getRetryCount()+", client "+req.getClient(container)+",
client-req "+req.getClientRequest()+ ')');
if(logMINOR) Logger.minor(this, "removeFirst()
returning "+req+" of "+req.getClientRequest());
return req;
Modified: branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
2009-02-03 16:47:06 UTC (rev 25493)
+++ branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -130,7 +130,7 @@
}
@Override
- public RequestClient getClient() {
+ public RequestClient getClient(ObjectContainer container) {
return this;
}
Modified:
branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
2009-02-03 16:47:06 UTC (rev 25493)
+++ branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -416,7 +416,8 @@
}
@Override
- public RequestClient getClient() {
+ public RequestClient getClient(ObjectContainer container) {
+ if(persistent) container.activate(parent, 1);
return parent.getClient();
}
Modified:
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
2009-02-03 16:47:06 UTC (rev 25493)
+++
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -463,7 +463,8 @@
}
@Override
- public RequestClient getClient() {
+ public RequestClient getClient(ObjectContainer container) {
+ if(persistent) container.activate(parent, 1);
return parent.getClient();
}
Modified: branches/db4o/freenet/src/freenet/node/SendableRequest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableRequest.java 2009-02-03
16:47:06 UTC (rev 25493)
+++ branches/db4o/freenet/src/freenet/node/SendableRequest.java 2009-02-03
16:55:35 UTC (rev 25494)
@@ -72,15 +72,17 @@
*/
public abstract boolean isCancelled(ObjectContainer container);
- /** Get client context object */
- public abstract RequestClient getClient();
+ /** Get client context object. This isn't called as frequently as you
might expect
+ * - once on registration, and then when there is an error. So it
doesn't need to be
+ * stored on the request itself, hence we pass in a container. */
+ public abstract RequestClient getClient(ObjectContainer container);
/** Is this request persistent? MUST NOT CHANGE. */
public final boolean persistent() {
return persistent;
}
- /** Get the ClientRequest */
+ /** Get the ClientRequest. This DOES need to be cached on the request
itself. */
public abstract ClientRequester getClientRequest();
public synchronized RandomGrabArray getParentGrabArray() {
Modified: branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
2009-02-03 16:47:06 UTC (rev 25493)
+++ branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
2009-02-03 16:55:35 UTC (rev 25494)
@@ -105,7 +105,7 @@
}
@Override
- public RequestClient getClient() {
+ public RequestClient getClient(ObjectContainer container) {
return client;
}
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs