r27163 - trunk/freenet/src/freenet/clients/http

[email protected] Tue, 21 Apr 2009 17:36:03 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-21 17:36:02 +0000 (Tue, 21 Apr 2009)
New Revision: 27163

Modified:
   trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java
   trunk/freenet/src/freenet/clients/http/FProxyFetchTracker.java
Log:
Logging, logging infrastructure


Modified: trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java	2009-04-21 17:32:03 UTC (rev 27162)
+++ trunk/freenet/src/freenet/clients/http/FProxyFetchInProgress.java	2009-04-21 17:36:02 UTC (rev 27163)
@@ -19,6 +19,7 @@
 import freenet.client.events.SplitfileProgressEvent;
 import freenet.keys.FreenetURI;
 import freenet.node.RequestClient;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Logger;
 import freenet.support.api.Bucket;
 
@@ -29,6 +30,18 @@
  */
 public class FProxyFetchInProgress implements ClientEventListener, ClientCallback {
 	
+	private static volatile boolean logMINOR;
+	
+	static {
+		Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+			
+			@Override
+			public void shouldUpdate() {
+				logMINOR = Logger.shouldLog(Logger.MINOR, this);
+			}
+		});
+	}
+	
 	/** The key we are fetching */
 	final FreenetURI uri;
 	/** The maximum size specified by the client */
@@ -217,15 +230,15 @@
 		if(!waiters.isEmpty()) return false;
 		if(!results.isEmpty()) return false;
 		if(lastTouched + LIFETIME >= System.currentTimeMillis()) {
-			Logger.error(this, "Not able to cancel for "+this+" : "+uri+" : "+maxSize);
+			if(logMINOR) Logger.minor(this, "Not able to cancel for "+this+" : "+uri+" : "+maxSize);
 			return false;
 		}
-		Logger.error(this, "Can cancel for "+this+" : "+uri+" : "+maxSize);
+		if(logMINOR) Logger.minor(this, "Can cancel for "+this+" : "+uri+" : "+maxSize);
 		return true;
 	}
 	
 	public void finishCancel() {
-		Logger.error(this, "Finishing cancel for "+this+" : "+uri+" : "+maxSize);
+		if(logMINOR) Logger.minor(this, "Finishing cancel for "+this+" : "+uri+" : "+maxSize);
 		if(data != null) {
 			try {
 				data.free();

Modified: trunk/freenet/src/freenet/clients/http/FProxyFetchTracker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyFetchTracker.java	2009-04-21 17:32:03 UTC (rev 27162)
+++ trunk/freenet/src/freenet/clients/http/FProxyFetchTracker.java	2009-04-21 17:36:02 UTC (rev 27163)
@@ -9,11 +9,24 @@
 import freenet.client.async.ClientContext;
 import freenet.keys.FreenetURI;
 import freenet.node.RequestClient;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Logger;
 import freenet.support.MultiValueTable;
 
 public class FProxyFetchTracker implements Runnable {
 
+	private static volatile boolean logMINOR;
+	
+	static {
+		Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+			
+			@Override
+			public void shouldUpdate() {
+				logMINOR = Logger.shouldLog(Logger.MINOR, this);
+			}
+		});
+	}
+	
 	final MultiValueTable<FreenetURI, FProxyFetchInProgress> fetchers;
 	final ClientContext context;
 	private long fetchIdentifiers;
@@ -60,7 +73,7 @@
 	}
 
 	public void queueCancel(FProxyFetchInProgress progress) {
-		Logger.error(this, "Queueing removal of old FProxyFetchInProgress's");
+		if(logMINOR) Logger.minor(this, "Queueing removal of old FProxyFetchInProgress's");
 		synchronized(this) {
 			if(queuedJob) {
 				requeue = true;
@@ -72,7 +85,7 @@
 	}
 
 	public void run() {
-		Logger.error(this, "Removing old FProxyFetchInProgress's");
+		if(logMINOR) Logger.minor(this, "Removing old FProxyFetchInProgress's");
 		ArrayList<FProxyFetchInProgress> toRemove = null;
 		boolean needRequeue = false;
 		synchronized(fetchers) {