Author: toad
Date: 2009-04-07 22:06:22 +0000 (Tue, 07 Apr 2009)
New Revision: 26619
Modified:
trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
trunk/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
trunk/freenet/src/freenet/client/async/OfferedKeysList.java
trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
trunk/freenet/src/freenet/node/SendableRequest.java
trunk/freenet/src/freenet/node/SimpleSendableInsert.java
Log:
sendableKeys/allKeys -> countSendableKeys/countAllKeys. We only use them to count, so count.
Modified: trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -52,13 +52,13 @@
}
@Override
- public SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context) {
- return keys;
+ public long countAllKeys(ObjectContainer container, ClientContext context) {
+ return 1;
}
@Override
- public SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context) {
- return keys;
+ public long countSendableKeys(ObjectContainer container, ClientContext context) {
+ return 1;
}
@Override
Modified: trunk/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/client/async/ClientRequestSchedulerBase.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -472,8 +472,8 @@
SendableRequest req = (SendableRequest) rga.get(m, container);
if(req == null) continue;
container.activate(req, 1);
- sendable += req.sendableKeys(container, context).length;
- all += req.allKeys(container, context).length;
+ sendable += req.countSendableKeys(container, context);
+ all += req.countAllKeys(container, context);
container.deactivate(req, 1);
}
System.out.println("Sendable keys: "+sendable+" all keys "+all+" diff "+(all-sendable));
Modified: trunk/freenet/src/freenet/client/async/OfferedKeysList.java
===================================================================
--- trunk/freenet/src/freenet/client/async/OfferedKeysList.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/client/async/OfferedKeysList.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -81,13 +81,13 @@
}
@Override
- public SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context) {
+ public long countAllKeys(ObjectContainer container, ClientContext context) {
// Not supported.
throw new UnsupportedOperationException();
}
@Override
- public SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context) {
+ public long countSendableKeys(ObjectContainer container, ClientContext context) {
// Not supported.
throw new UnsupportedOperationException();
}
Modified: trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleBlockInserter.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/client/async/SingleBlockInserter.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -553,16 +553,16 @@
}
@Override
- public synchronized SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context) {
+ public synchronized long countSendableKeys(ObjectContainer container, ClientContext context) {
if(finished)
- return new SendableRequestItem[] {};
+ return 0;
else
- return new SendableRequestItem[] { NullSendableRequestItem.nullItem };
+ return 1;
}
@Override
- public synchronized SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context) {
- return sendableKeys(container, context);
+ public synchronized long countAllKeys(ObjectContainer container, ClientContext context) {
+ return countSendableKeys(container, context);
}
@Override
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -119,7 +119,7 @@
* those on cooldown queues. This is important when unregistering.
*/
@Override
- public SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context) {
+ public long countAllKeys(ObjectContainer container, ClientContext context) {
if(persistent) {
container.activate(this, 1);
container.activate(segment, 1);
@@ -127,20 +127,20 @@
// j16sdiz (22-DEC-2008):
// ClientRequestSchedular.removePendingKeys() call this to get a list of request to be removed
// FIXME ClientRequestSchedular.removePendingKeys() is leaking, what's missing here?
- return convertIntegerToMySendableRequestItems(segment.getKeyNumbersAtRetryLevel(retryCount));
+ return segment.getKeyNumbersAtRetryLevel(retryCount).length;
}
/**
* Just those keys which are eligible to be started now.
*/
@Override
- public SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context) {
+ public long countSendableKeys(ObjectContainer container, ClientContext context) {
if(persistent) {
container.activate(this, 1);
container.activate(blockNums, 1);
}
cleanBlockNums(container);
- return convertIntegerToMySendableRequestItems(blockNums.toArray(new Integer[blockNums.size()]));
+ return blockNums.size();
}
private SendableRequestItem[] convertIntegerToMySendableRequestItems(Integer[] nums) {
Modified: trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/client/async/SplitFileInserterSegment.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -1285,8 +1285,8 @@
}
@Override
- public SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context) {
- return sendableKeys(container, context);
+ public long countAllKeys(ObjectContainer container, ClientContext context) {
+ return countSendableKeys(container, context);
}
@Override
@@ -1466,22 +1466,15 @@
}
@Override
- public synchronized SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context) {
+ public synchronized long countSendableKeys(ObjectContainer container, ClientContext context) {
if(persistent) {
container.activate(blocks, 1);
}
- SendableRequestItem[] items = new SendableRequestItem[blocks.size()];
- for(int i=0;i<blocks.size();i++)
- try {
- items[i] = getBlockItem(container, context, blocks.get(i));
- } catch (IOException e) {
- fail(new InsertException(InsertException.BUCKET_ERROR, e, null), container, context);
- return null;
- }
+ int sz = blocks.size();
if(persistent) {
container.deactivate(blocks, 1);
}
- return items;
+ return sz;
}
public synchronized boolean isEmpty(ObjectContainer container) {
Modified: trunk/freenet/src/freenet/node/SendableRequest.java
===================================================================
--- trunk/freenet/src/freenet/node/SendableRequest.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/node/SendableRequest.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -52,11 +52,11 @@
/** All key identifiers. Including those not currently eligible to be sent because
* they are on a cooldown queue, requests for them are in progress, etc. */
- public abstract SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context);
+ public abstract long countAllKeys(ObjectContainer container, ClientContext context);
/** All key identifiers currently eligible to be sent. Does not include those
* currently running, on the cooldown queue etc. */
- public abstract SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context);
+ public abstract long countSendableKeys(ObjectContainer container, ClientContext context);
/**
* Get or create a SendableRequestSender for this object. This is a non-persistent
Modified: trunk/freenet/src/freenet/node/SimpleSendableInsert.java
===================================================================
--- trunk/freenet/src/freenet/node/SimpleSendableInsert.java 2009-04-07 21:59:17 UTC (rev 26618)
+++ trunk/freenet/src/freenet/node/SimpleSendableInsert.java 2009-04-07 22:06:22 UTC (rev 26619)
@@ -140,15 +140,15 @@
}
@Override
- public synchronized SendableRequestItem[] allKeys(ObjectContainer container, ClientContext context) {
- if(finished) return new SendableRequestItem[] {};
- return new SendableRequestItem[] { NullSendableRequestItem.nullItem };
+ public synchronized long countAllKeys(ObjectContainer container, ClientContext context) {
+ if(finished) return 0;
+ return 1;
}
@Override
- public synchronized SendableRequestItem[] sendableKeys(ObjectContainer container, ClientContext context) {
- if(finished) return new SendableRequestItem[] {};
- return new SendableRequestItem[] { NullSendableRequestItem.nullItem };
+ public synchronized long countSendableKeys(ObjectContainer container, ClientContext context) {
+ if(finished) return 0;
+ return 1;
}
@Override
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.