Author: toad
Date: 2007-02-16 19:56:40 +0000 (Fri, 16 Feb 2007)
New Revision: 11817
Modified:
trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
trunk/freenet/src/freenet/node/SendableGet.java
trunk/freenet/src/freenet/node/SimpleSendableInsert.java
trunk/freenet/src/freenet/support/RandomGrabArray.java
trunk/freenet/src/freenet/support/RandomGrabArrayItem.java
trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
Log:
Rename and document RandomGrabArrayItem.isFinished -> isCancelled.
Modified: trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
2007-02-16 19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
2007-02-16 19:56:40 UTC (rev 11817)
@@ -19,7 +19,7 @@
}
public void queue(SingleBlockInserter sbi) {
- if(sbi.isFinished()) return;
+ if(sbi.isCancelled()) return;
if(sbi.resultingURI != null) return;
WeakReference ref = new WeakReference(sbi);
synchronized(this) {
@@ -33,7 +33,7 @@
synchronized(this) {
for(int i=0;i<sbis.length;i++) {
if(sbis[i] == null) continue;
- if(sbis[i].isFinished()) continue;
+ if(sbis[i].isCancelled()) continue;
if(sbis[i].resultingURI != null) continue;
Logger.minor(this, "Queueing encode of
"+sbis[i]);
WeakReference ref = new WeakReference(sbis[i]);
@@ -61,7 +61,7 @@
}
}
Logger.minor(this, "Encoding "+sbi);
- if(sbi.isFinished()) continue;
+ if(sbi.isCancelled()) continue;
if(sbi.resultingURI != null) continue;
sbi.tryEncode();
}
Modified: trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2007-02-16 19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
2007-02-16 19:56:40 UTC (rev 11817)
@@ -65,7 +65,7 @@
cancelled = true;
}
- public synchronized boolean isFinished() {
+ public synchronized boolean isCancelled() {
return cancelled;
}
Modified: trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2007-02-16 19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/client/async/SingleBlockInserter.java
2007-02-16 19:56:40 UTC (rev 11817)
@@ -279,7 +279,7 @@
cb.onFailure(new
InserterException(InserterException.CANCELLED), this);
}
- public synchronized boolean isFinished() {
+ public synchronized boolean isCancelled() {
return finished;
}
Modified: trunk/freenet/src/freenet/node/SendableGet.java
===================================================================
--- trunk/freenet/src/freenet/node/SendableGet.java 2007-02-16 19:54:01 UTC
(rev 11816)
+++ trunk/freenet/src/freenet/node/SendableGet.java 2007-02-16 19:56:40 UTC
(rev 11817)
@@ -47,7 +47,7 @@
/** Do the request, blocking. Called by RequestStarter. */
public void send(NodeClientCore core) {
synchronized (this) {
- if(isFinished()) {
+ if(isCancelled()) {
onFailure(new
LowLevelGetException(LowLevelGetException.CANCELLED));
return;
}
Modified: trunk/freenet/src/freenet/node/SimpleSendableInsert.java
===================================================================
--- trunk/freenet/src/freenet/node/SimpleSendableInsert.java 2007-02-16
19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/node/SimpleSendableInsert.java 2007-02-16
19:56:40 UTC (rev 11817)
@@ -69,7 +69,7 @@
return null;
}
- public boolean isFinished() {
+ public boolean isCancelled() {
return finished;
}
Modified: trunk/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/RandomGrabArray.java 2007-02-16
19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/support/RandomGrabArray.java 2007-02-16
19:56:40 UTC (rev 11817)
@@ -31,7 +31,7 @@
public synchronized void add(RandomGrabArrayItem req) {
if(contents.contains(req)) return;
- if(req.isFinished()) {
+ if(req.isCancelled()) {
if(Logger.shouldLog(Logger.MINOR, this))
Logger.minor(this, "Is finished already: "+req);
return;
@@ -63,7 +63,7 @@
System.arraycopy(reqs, 0, r, 0, r.length);
reqs = r;
}
- if((ret != null) && !ret.isFinished()) return ret;
+ if((ret != null) && !ret.isCancelled()) return ret;
}
}
Modified: trunk/freenet/src/freenet/support/RandomGrabArrayItem.java
===================================================================
--- trunk/freenet/src/freenet/support/RandomGrabArrayItem.java 2007-02-16
19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/support/RandomGrabArrayItem.java 2007-02-16
19:56:40 UTC (rev 11817)
@@ -2,8 +2,11 @@
public interface RandomGrabArrayItem {
- /** If true, will be automatically removed from the RGA, and not
returned. */
- public boolean isFinished();
+ /** If true, will be automatically removed from the RGA, and not
returned.
+ * True indicates that the item is no longer needed for some reason -
in a request,
+ * usually that it has either been explicitly cancelled or that it is
not needed
+ * because other queued blocks have been sufficient. */
+ public boolean isCancelled();
/** Can this item be removed from the queue?
* Called immediately after finding a request to remove.
Modified: trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2007-02-16 19:54:01 UTC (rev 11816)
+++ trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2007-02-16 19:56:40 UTC (rev 11817)
@@ -76,7 +76,7 @@
grabArrays = newArray;
}
if(item == null) continue;
- if(item.isFinished()) continue;
+ if(item.isCancelled()) continue;
return item;
}
}