Author: toad
Date: 2008-01-17 16:33:46 +0000 (Thu, 17 Jan 2008)
New Revision: 17096

Modified:
   trunk/freenet/src/freenet/support/RandomGrabArray.java
Log:
logging

Modified: trunk/freenet/src/freenet/support/RandomGrabArray.java
===================================================================
--- trunk/freenet/src/freenet/support/RandomGrabArray.java      2008-01-17 
16:28:15 UTC (rev 17095)
+++ trunk/freenet/src/freenet/support/RandomGrabArray.java      2008-01-17 
16:33:46 UTC (rev 17096)
@@ -54,8 +54,8 @@

        public RandomGrabArrayItem removeRandom() {
                RandomGrabArrayItem ret, oret;
+               boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                synchronized(this) {
-                       boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        while(true) {
                                if(index == 0) {
                                        if(logMINOR) Logger.minor(this, "All 
null on "+this);
@@ -64,8 +64,12 @@
                                int i = rand.nextInt(index);
                                ret = reqs[i];
                                oret = ret;
-                               if(ret.isCancelled()) ret = null;
+                               if(ret.isCancelled()) {
+                                       if(logMINOR) Logger.minor(this, "Not 
returning because cancelled: "+ret);
+                                       ret = null;
+                               }
                                if(ret != null && !ret.canRemove()) {
+                                       if(logMINOR) Logger.minor(this, 
"Returning (cannot remove): "+ret);
                                        return ret;
                                }
                                do {
@@ -87,6 +91,7 @@
                                if((ret != null) && !ret.isCancelled()) break;
                        }
                }
+               if(logMINOR) Logger.minor(this, "Returning "+ret);
                ret.setParentGrabArray(null);
                return ret;
        }


Reply via email to