Author: toad
Date: 2008-06-21 11:42:51 +0000 (Sat, 21 Jun 2008)
New Revision: 20555
Modified:
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/node/BaseSendableGet.java
branches/db4o/freenet/src/freenet/node/SendableGet.java
branches/db4o/freenet/src/freenet/node/SendableInsert.java
branches/db4o/freenet/src/freenet/node/SendableRequest.java
branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
Log:
Make persistent a final field on SendableRequest.
This enables it to be queried without activating the request.
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-06-21 10:49:02 UTC (rev 20554)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-06-21 11:42:51 UTC (rev 20555)
@@ -300,7 +300,9 @@
if(req == null) {
if(logMINOR) Logger.minor(this, "No requests,
adjusted retrycount "+chosenTracker.getNumber()+" ("+chosenTracker+") of
priority "+choosenPriorityClass);
continue; // Try next retry count.
- } else if(req.getPriorityClass() !=
choosenPriorityClass) {
+ }
+ container.activate(req, Integer.MAX_VALUE); // FIXME
+ if(req.getPriorityClass() != choosenPriorityClass) {
// Reinsert it : shouldn't happen if we are
calling reregisterAll,
// maybe we should ask people to report that
error if seen
Logger.normal(this, "In wrong priority class:
"+req+" (req.prio="+req.getPriorityClass()+" but chosen="+choosenPriorityClass+
')');
Modified: branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
2008-06-21 10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
2008-06-21 11:42:51 UTC (rev 20555)
@@ -43,6 +43,7 @@
private final NodeClientCore core;
OfferedKeysList(NodeClientCore core, RandomSource random, short
priorityClass) {
+ super(false);
this.keys = new HashSet();
this.keysList = new Vector();
this.random = random;
@@ -179,8 +180,4 @@
return (Key) token;
}
- public boolean persistent() {
- return false;
- }
-
}
Modified:
branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
2008-06-21 10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
2008-06-21 11:42:51 UTC (rev 20555)
@@ -57,6 +57,7 @@
private int consecutiveRNFs;
public SingleBlockInserter(BaseClientPutter parent, Bucket data, short
compressionCodec, FreenetURI uri, InsertContext ctx, PutCompletionCallback cb,
boolean isMetadata, int sourceLength, int token, boolean getCHKOnly, boolean
addToParent, boolean dontSendEncoded, Object tokenObject, ObjectContainer
container, ClientContext context) {
+ super(parent.persistent());
this.consecutiveRNFs = 0;
this.tokenObject = tokenObject;
this.token = token;
Modified: branches/db4o/freenet/src/freenet/node/BaseSendableGet.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/BaseSendableGet.java 2008-06-21
10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/node/BaseSendableGet.java 2008-06-21
11:42:51 UTC (rev 20555)
@@ -7,6 +7,10 @@
public abstract class BaseSendableGet extends SendableRequest {
+ protected BaseSendableGet(boolean persistent) {
+ super(persistent);
+ }
+
/** Get a numbered key to fetch. */
public abstract Key getNodeKey(Object token, ObjectContainer container);
Modified: branches/db4o/freenet/src/freenet/node/SendableGet.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableGet.java 2008-06-21
10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/node/SendableGet.java 2008-06-21
11:42:51 UTC (rev 20555)
@@ -55,6 +55,7 @@
// Implementation
public SendableGet(ClientRequester parent) {
+ super(parent.persistent());
this.parent = parent;
}
Modified: branches/db4o/freenet/src/freenet/node/SendableInsert.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableInsert.java 2008-06-21
10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/node/SendableInsert.java 2008-06-21
11:42:51 UTC (rev 20555)
@@ -15,6 +15,10 @@
*/
public abstract class SendableInsert extends SendableRequest {
+ public SendableInsert(boolean persistent) {
+ super(persistent);
+ }
+
/** Called when we successfully insert the data */
public abstract void onSuccess(Object keyNum, ObjectContainer
container, ClientContext context);
Modified: branches/db4o/freenet/src/freenet/node/SendableRequest.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableRequest.java 2008-06-21
10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/node/SendableRequest.java 2008-06-21
11:42:51 UTC (rev 20555)
@@ -18,7 +18,13 @@
*/
public abstract class SendableRequest implements RandomGrabArrayItem {
+ SendableRequest(boolean persistent) {
+ this.persistent = persistent;
+ }
+
protected RandomGrabArray parentGrabArray;
+ /** Member because must be accessible when only marginally activated */
+ final boolean persistent;
/** Get the priority class of the request. */
public abstract short getPriorityClass();
@@ -61,8 +67,8 @@
public abstract RequestClient getClient();
/** Is this request persistent? MUST NOT CHANGE. */
- public boolean persistent() {
- return getClient().persistent();
+ public final boolean persistent() {
+ return persistent;
}
/** Get the ClientRequest */
Modified: branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
2008-06-21 10:49:02 UTC (rev 20554)
+++ branches/db4o/freenet/src/freenet/node/SimpleSendableInsert.java
2008-06-21 11:42:51 UTC (rev 20555)
@@ -30,6 +30,7 @@
public final ClientRequestScheduler scheduler;
public SimpleSendableInsert(NodeClientCore core, KeyBlock block, short
prioClass) {
+ super(false);
this.block = block;
this.prioClass = prioClass;
this.client = core.node.nonPersistentClient;
@@ -42,6 +43,7 @@
}
public SimpleSendableInsert(KeyBlock block, short prioClass,
RequestClient client, ClientRequestScheduler scheduler) {
+ super(false);
this.block = block;
this.prioClass = prioClass;
this.client = client;