Author: nextgens
Date: 2009-01-30 13:28:50 +0000 (Fri, 30 Jan 2009)
New Revision: 25393

Modified:
   trunk/freenet/src/freenet/io/NetworkInterface.java
Log:
same thing: don\'t need to get access to the logger\'s monitor on each packet 
we receive

Modified: trunk/freenet/src/freenet/io/NetworkInterface.java
===================================================================
--- trunk/freenet/src/freenet/io/NetworkInterface.java  2009-01-30 12:29:54 UTC 
(rev 25392)
+++ trunk/freenet/src/freenet/io/NetworkInterface.java  2009-01-30 13:28:50 UTC 
(rev 25393)
@@ -32,6 +32,7 @@
 import freenet.io.AddressIdentifier.AddressType;
 import freenet.support.Executor;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 
 /**
  * Replacement for {...@link ServerSocket} that can handle multiple bind 
addresses
@@ -42,6 +43,15 @@
  */
 public class NetworkInterface implements Closeable {
     
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
         public static final String DEFAULT_BIND_TO = 
"127.0.0.1,0:0:0:0:0:0:0:1";
         
        /** Object for synchronisation purpose. */
@@ -297,7 +307,6 @@
                public void run() {
                    freenet.support.Logger.OSThread.logPID(this);
                        while (!closed) {
-                               boolean logMINOR = 
Logger.shouldLog(Logger.MINOR, this);
                                try {
                                        Socket clientSocket = 
serverSocket.accept();
                                        InetAddress clientAddress = 
clientSocket.getInetAddress();

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

Reply via email to