Author: toad
Date: 2009-02-20 20:50:14 +0000 (Fri, 20 Feb 2009)
New Revision: 25751
Modified:
branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
Log:
Persistent hashCode for RGA, good for debugging (and for hashtable keys if
necessary). Add a FIXME.
Modified: branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
2009-02-20 20:48:48 UTC (rev 25750)
+++ branches/db4o/freenet/src/freenet/support/RandomGrabArray.java
2009-02-20 20:50:14 UTC (rev 25751)
@@ -23,14 +23,20 @@
private final static int MIN_SIZE = 32;
private final static int BLOCK_SIZE = 1024;
private final boolean persistent;
+ private final int hashCode;
public RandomGrabArray(boolean persistent, ObjectContainer container) {
this.blocks = new Block[] { new Block() };
blocks[0].reqs = new RandomGrabArrayItem[MIN_SIZE];
this.persistent = persistent;
index = 0;
+ this.hashCode = super.hashCode();
}
+ public int hashCode() {
+ return hashCode;
+ }
+
public void add(RandomGrabArrayItem req, ObjectContainer container) {
if(req.persistent() != persistent) throw new
IllegalArgumentException("req.persistent()="+req.persistent()+" but
array.persistent="+persistent+" item="+req+" array="+this);
boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
@@ -350,6 +356,14 @@
}
}
+ /**
+ * FIXME: This does not remove from higher level structures! This will
only
+ * be removed from the SectoredRGA the next time the request selection
loop
+ * runs - and if there are higher priority requests, and hard
priorities are
+ * enabled, it may not reach this.
+ * @param it
+ * @param container
+ */
public void remove(RandomGrabArrayItem it, ObjectContainer container) {
if(Logger.shouldLog(Logger.MINOR, this))
Logger.minor(this, "Removing "+it+" from "+this);
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs