r26768 - trunk/freenet/src/freenet/node

[email protected]
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: j16sdiz
Date: 2009-04-14 04:42:50 +0000 (Tue, 14 Apr 2009)
New Revision: 26768

Modified:
   trunk/freenet/src/freenet/node/FailureTableEntry.java
Log:
Don't call shouldLog() for each instance

Modified: trunk/freenet/src/freenet/node/FailureTableEntry.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTableEntry.java	2009-04-14 04:42:30 UTC (rev 26767)
+++ trunk/freenet/src/freenet/node/FailureTableEntry.java	2009-04-14 04:42:50 UTC (rev 26768)
@@ -42,8 +42,17 @@
 	long[] requestedTimeouts;
 	short[] requestedTimeoutHTLs;
 	
-	static boolean logMINOR;
+	private static volatile boolean logMINOR;
 	
+	static {
+		Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+			@Override
+			public void shouldUpdate() {
+				logMINOR = Logger.shouldLog(Logger.MINOR, this);
+			}
+		});
+	}
+	
 	/** We remember that a node has asked us for a key for up to an hour; after that, we won't offer the key, and
 	 * if we receive an offer from that node, we will reject it */
 	static final int MAX_TIME_BETWEEN_REQUEST_AND_OFFER = 60 * 60 * 1000;
@@ -57,7 +66,6 @@
 	FailureTableEntry(Key key) {
 		this.key = key;
 		if(key == null) throw new NullPointerException();
-		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		long now = System.currentTimeMillis();
 		creationTime = now;
 		receivedTime = -1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.