Author: toad
Date: 2007-08-09 09:56:03 +0000 (Thu, 09 Aug 2007)
New Revision: 14553

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

Modified: trunk/freenet/src/freenet/support/TokenBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/TokenBucket.java  2007-08-09 01:42:30 UTC 
(rev 14552)
+++ trunk/freenet/src/freenet/support/TokenBucket.java  2007-08-09 09:56:03 UTC 
(rev 14553)
@@ -34,7 +34,11 @@
         * @return True if we could acquire the tokens.
         */
        public synchronized boolean instantGrab(long tokens) {
+               if(logMINOR)
+                       Logger.minor(this, "instant grab: "+tokens+" 
current="+current+" max="+max);
                addTokens();
+               if(logMINOR)
+                       Logger.minor(this, "instant grab: "+tokens+" 
current="+current+" max="+max);
                if(current > tokens) {
                        current -= tokens;
                        if(current > max) current = max;
@@ -173,6 +177,8 @@
        public synchronized void addTokens() {
                addTokensNoClip();
                if(current > max) current = max;
+               if(logMINOR)
+                       Logger.minor(this, "addTokens: Clipped, 
current="+current);
        }

        /**
@@ -182,6 +188,8 @@
                long add = tokensToAdd();
                current += add;
                timeLastTick += add * nanosPerTick;
+               if(logMINOR)
+                       Logger.minor(this, "addTokensNoClip: Added "+add+" 
tokens, current="+current);
                // Deliberately do not clip to size at this point; caller must 
do this, but it is usually beneficial for the caller to do so.
        }



Reply via email to