Author: nextgens
Date: 2009-02-03 11:49:51 +0000 (Tue, 03 Feb 2009)
New Revision: 25485

Modified:
   trunk/freenet/src/freenet/client/async/USKFetcher.java
Log:
more Logger.shouldLog() removal

Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-02-03 
11:36:00 UTC (rev 25484)
+++ trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-02-03 
11:49:51 UTC (rev 25485)
@@ -16,6 +16,7 @@
 import freenet.keys.USK;
 import freenet.node.RequestStarter;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.api.Bucket;
 
 /**
@@ -61,8 +62,17 @@
  * - Passive requests (when we have passive requests).
  */
 public class USKFetcher implements ClientGetState {
+    private static volatile boolean logMINOR;
 
-       private static boolean logMINOR;
+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+
+            @Override
+            public void shouldUpdate() {
+                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+            }
+        });
+    }
        
        /** USK manager */
        private final USKManager uskManager;
@@ -227,11 +237,9 @@
                this.ctx = ctx;
                this.backgroundPoll = pollForever;
                this.keepLastData = keepLastData;
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }
        
        void onDNF(USKAttempt att) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "DNF: "+att);
                boolean finished = false;
                long curLatest = uskManager.lookup(origUSK);
@@ -297,7 +305,6 @@
        }
 
        void onSuccess(USKAttempt att, boolean dontUpdate, ClientSSKBlock 
block) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                LinkedList<USKAttempt> l = null;
                final long lastEd = uskManager.lookup(origUSK);
                long curLatest;

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to