Author: toad
Date: 2007-05-02 19:24:06 +0000 (Wed, 02 May 2007)
New Revision: 13111
Modified:
trunk/freenet/src/freenet/support/RandomGrabArray.java
trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
Log:
Logging
Modified: trunk/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/RandomGrabArray.java 2007-05-02
19:18:53 UTC (rev 13110)
+++ trunk/freenet/src/freenet/support/RandomGrabArray.java 2007-05-02
19:24:06 UTC (rev 13111)
@@ -30,14 +30,17 @@
}
public void add(RandomGrabArrayItem req) {
+ boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(req.isCancelled()) {
- if(Logger.shouldLog(Logger.MINOR, this))
- Logger.minor(this, "Is finished already: "+req);
+ if(logMINOR) Logger.minor(this, "Is finished already:
"+req);
return;
}
req.setParentGrabArray(this);
synchronized(this) {
- if(contents.contains(req)) return;
+ if(contents.contains(req)) {
+ if(logMINOR) Logger.minor(this, "Already
contains "+req+" : "+this+" size now "+index);
+ return;
+ }
contents.add(req);
if(index >= reqs.length) {
RandomGrabArrayItem[] r = new
RandomGrabArrayItem[reqs.length*2];
@@ -45,6 +48,7 @@
reqs = r;
}
reqs[index++] = req;
+ if(logMINOR) Logger.minor(this, "Added: "+req+" to
"+this+" size now "+index);
}
}
Modified: trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2007-05-02 19:18:53 UTC (rev 13110)
+++ trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
2007-05-02 19:24:06 UTC (rev 13111)
@@ -23,8 +23,11 @@
/**
* Add directly to a RandomGrabArrayWithClient under us. */
public synchronized void add(Object client, RandomGrabArrayItem item) {
+ boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
RandomGrabArrayWithClient rga;
if(!grabArraysByClient.containsKey(client)) {
+ if(logMINOR)
+ Logger.minor(this, "Adding new RGAWithClient
for "+client+" on "+this+" for "+item);
rga = new RandomGrabArrayWithClient(client, rand);
RemoveRandomWithClient[] newArrays = new
RemoveRandomWithClient[grabArrays.length+1];
System.arraycopy(grabArrays, 0, newArrays, 0,
grabArrays.length);
@@ -34,6 +37,8 @@
} else {
rga = (RandomGrabArrayWithClient)
grabArraysByClient.get(client);
}
+ if(logMINOR)
+ Logger.minor(this, "Adding "+item+" to RGA "+rga+" for
"+client);
rga.add(item);
}