Author: nextgens
Date: 2007-09-03 23:15:32 +0000 (Mon, 03 Sep 2007)
New Revision: 14949

Modified:
   trunk/freenet/src/freenet/client/FECCodec.java
   trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
   trunk/freenet/src/freenet/client/async/SingleFileInserter.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/io/NetworkInterface.java
   trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
   trunk/freenet/src/freenet/node/CHKInsertSender.java
   trunk/freenet/src/freenet/node/DNSRequester.java
   trunk/freenet/src/freenet/node/GlobalProbe.java
   trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
   trunk/freenet/src/freenet/node/InsertHandler.java
   trunk/freenet/src/freenet/node/LocationManager.java
   trunk/freenet/src/freenet/node/LoggingConfigHandler.java
   trunk/freenet/src/freenet/node/MemoryChecker.java
   trunk/freenet/src/freenet/node/NodePinger.java
   trunk/freenet/src/freenet/node/NodeStarter.java
   trunk/freenet/src/freenet/node/PacketSender.java
   trunk/freenet/src/freenet/node/Persister.java
   trunk/freenet/src/freenet/node/RequestHandler.java
   trunk/freenet/src/freenet/node/RequestSender.java
   trunk/freenet/src/freenet/node/RequestStarter.java
   trunk/freenet/src/freenet/node/SSKInsertHandler.java
   trunk/freenet/src/freenet/node/SSKInsertSender.java
   trunk/freenet/src/freenet/node/TestnetHandler.java
   trunk/freenet/src/freenet/node/TestnetStatusUploader.java
   trunk/freenet/src/freenet/node/TextModeClientInterface.java
   trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
   trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
   trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java
   trunk/freenet/src/freenet/node/fcp/FCPServer.java
   trunk/freenet/src/freenet/support/Logger.java
   trunk/freenet/src/freenet/support/OSThread.java
   trunk/freenet/src/freenet/support/transport/ip/IPAddressDetector.java
Log:
Make OSThread a static class

Modified: trunk/freenet/src/freenet/client/FECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/FECCodec.java      2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/client/FECCodec.java      2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -373,7 +373,7 @@
        private static class FECRunner implements Runnable {

                public void run(){
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        try {
                        while(true){
                                FECJob job = null;

Modified: trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java  
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java  
2007-09-03 23:15:32 UTC (rev 14949)
@@ -45,7 +45,7 @@
        }

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
                while(true) {
                        SingleBlockInserter sbi = null;
                        synchronized(this) {

Modified: trunk/freenet/src/freenet/client/async/SingleFileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileInserter.java      
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/client/async/SingleFileInserter.java      
2007-09-03 23:15:32 UTC (rev 14949)
@@ -114,7 +114,7 @@

        private class OffThreadCompressor implements Runnable {
                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        try {
                                tryCompress();
                        } catch (InsertException e) {

Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-09-03 23:15:32 UTC (rev 14949)
@@ -425,7 +425,7 @@
                }

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        if(logMINOR) Logger.minor(this, "Handling connection");
                        try {

Modified: trunk/freenet/src/freenet/io/NetworkInterface.java
===================================================================
--- trunk/freenet/src/freenet/io/NetworkInterface.java  2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/io/NetworkInterface.java  2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -277,7 +277,7 @@
                 * @see NetworkInterface#allowedHosts
                 */
                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        while (!closed) {
                                boolean logMINOR = 
Logger.shouldLog(Logger.MINOR, this);
                                try {

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2007-09-03 
23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2007-09-03 
23:15:32 UTC (rev 14949)
@@ -274,7 +274,7 @@

        public class USMChecker implements Runnable {
                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        while(true) {
                                if(_isDone) return; // don't synchronize 
because don't want to deadlock - this is our recovery mechanism
                                logMINOR = Logger.shouldLog(Logger.MINOR, 
UdpSocketHandler.this);

Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertSender.java 2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/CHKInsertSender.java 2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -37,7 +37,7 @@
                }

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        try {
                                bt.send(executor);
                                if(bt.failedDueToOverload()) {
@@ -200,7 +200,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         short origHTL;
        synchronized (this) {
             origHTL = htl;
@@ -639,7 +639,7 @@
        private class CompletionWaiter implements Runnable {

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        if(logMINOR) Logger.minor(this, "Starting "+this);

                        // Wait for the request to reach a terminal stage.

Modified: trunk/freenet/src/freenet/node/DNSRequester.java
===================================================================
--- trunk/freenet/src/freenet/node/DNSRequester.java    2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/DNSRequester.java    2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -30,7 +30,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         while(true) {
             try {
                 realRun();

Modified: trunk/freenet/src/freenet/node/GlobalProbe.java
===================================================================
--- trunk/freenet/src/freenet/node/GlobalProbe.java     2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/GlobalProbe.java     2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -39,7 +39,7 @@
        }

        public void run() {
-               freenet.support.OSThread.logPID(this);
+               freenet.support.Logger.OSThread.logPID(this);
                synchronized(this) {
                        lastLocation = 0.0;
                        double prevLoc = lastLocation;

Modified: trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
===================================================================
--- trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2007-09-03 
23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2007-09-03 
23:15:32 UTC (rev 14949)
@@ -152,7 +152,7 @@
                }
                node.getTicker().queueTimedJob(new Runnable() {
                        public void run() {
-                               freenet.support.OSThread.logPID(this);
+                               freenet.support.Logger.OSThread.logPID(this);
                                tryMaybeRun();
                        }
                }, 60*1000);
@@ -476,7 +476,7 @@
        public class DetectorRunner implements Runnable {

                public void run() {
-                       freenet.support.OSThread.logPID(this);
+                       freenet.support.Logger.OSThread.logPID(this);
                        try {
                                realRun();
                        } catch (OutOfMemoryError e) {

Modified: trunk/freenet/src/freenet/node/InsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/InsertHandler.java   2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/InsertHandler.java   2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -71,7 +71,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         try {
                realRun();
                } catch (OutOfMemoryError e) {
@@ -401,7 +401,7 @@
     public class DataReceiver implements Runnable {

         public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                synchronized(this) {
                        receiveStarted = true;
                }

Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -144,7 +144,7 @@
     public class SwapRequestSender implements Runnable {

         public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
             while(true) {
                 try {
                     long startTime = System.currentTimeMillis();
@@ -245,7 +245,7 @@
         }

         public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
             MessageDigest md = SHA256.getMessageDigest();

             boolean reachedEnd = false;
@@ -403,7 +403,7 @@
         RecentlyForwardedItem item;

         public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
             long uid = r.nextLong();            
             if(!lock()) return;
             boolean reachedEnd = false;

Modified: trunk/freenet/src/freenet/node/LoggingConfigHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/LoggingConfigHandler.java    2007-09-03 
23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/LoggingConfigHandler.java    2007-09-03 
23:15:32 UTC (rev 14949)
@@ -302,7 +302,7 @@
                }

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        fileLoggerHook.waitForSwitch();
                        delete(logDir);
                }

Modified: trunk/freenet/src/freenet/node/MemoryChecker.java
===================================================================
--- trunk/freenet/src/freenet/node/MemoryChecker.java   2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/MemoryChecker.java   2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -32,7 +32,7 @@
        }

        public void run() {
-               freenet.support.OSThread.logPID(this);
+               freenet.support.Logger.OSThread.logPID(this);
                if(!goon){
                        Logger.normal(this, "Goon is false ; killing 
MemoryChecker");
                        return;

Modified: trunk/freenet/src/freenet/node/NodePinger.java
===================================================================
--- trunk/freenet/src/freenet/node/NodePinger.java      2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/NodePinger.java      2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -32,7 +32,7 @@
        final Node node;

        public void run() {
-           //freenet.support.OSThread.logPID(this);
+           //freenet.support.OSThread.RealOSThread.logPID(this);
                try {
                        recalculateMean(node.peers.connectedPeers);
                } finally {

Modified: trunk/freenet/src/freenet/node/NodeStarter.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStarter.java     2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/NodeStarter.java     2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -30,8 +30,7 @@
  *     A class to tie the wrapper and the node (needed for self-restarting 
support)
  *
  */
-public class NodeStarter
-    implements WrapperListener
+public class NodeStarter implements WrapperListener
 {
     private Node node;
        private static LoggingConfigHandler logConfigHandler;

Modified: trunk/freenet/src/freenet/node/PacketSender.java
===================================================================
--- trunk/freenet/src/freenet/node/PacketSender.java    2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/PacketSender.java    2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -70,7 +70,7 @@
     private class Watchdog implements Runnable {

        public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                // Do not lock anything, or we may be caught up with a 
lost-lock deadlock.
                while(true) {
                        try {
@@ -121,7 +121,7 @@
        if(now < transition) {
                queueTimedJob(new Runnable() {
                        public void run() {
-                                   freenet.support.OSThread.logPID(this);
+                                   
freenet.support.Logger.OSThread.logPID(this);
                                PeerNode[] nodes = node.peers.myPeers;
                                for(int i=0;i<nodes.length;i++) {
                                        PeerNode pn = nodes[i];
@@ -141,7 +141,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         while(true) {
             lastReceivedPacketFromAnyNode = lastReportedNoPackets;
             try {

Modified: trunk/freenet/src/freenet/node/Persister.java
===================================================================
--- trunk/freenet/src/freenet/node/Persister.java       2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/Persister.java       2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -41,7 +41,7 @@
        }

        public void run() {
-               freenet.support.OSThread.logPID(this);
+               freenet.support.Logger.OSThread.logPID(this);
                try {
                        persistThrottle();
                } catch (OutOfMemoryError e) {

Modified: trunk/freenet/src/freenet/node/RequestHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestHandler.java  2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/RequestHandler.java  2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -73,7 +73,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
        boolean thrown = false;
         try {
                realRun();

Modified: trunk/freenet/src/freenet/node/RequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestSender.java   2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/RequestSender.java   2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -117,7 +117,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         if((key instanceof NodeSSK) && (pubKey == null)) {
                pubKey = ((NodeSSK)key).getPubKey();
         }

Modified: trunk/freenet/src/freenet/node/RequestStarter.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestStarter.java  2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/RequestStarter.java  2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -142,7 +142,7 @@
        }

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
                while(true) {
                        try {
                                realRun();
@@ -163,7 +163,7 @@
                }

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        if(!req.send(core, sched))
                                Logger.normal(this, "run() not able to send a 
request");
                        if(Logger.shouldLog(Logger.MINOR, this)) 

Modified: trunk/freenet/src/freenet/node/SSKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertHandler.java        2007-09-03 
23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/SSKInsertHandler.java        2007-09-03 
23:15:32 UTC (rev 14949)
@@ -75,7 +75,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         try {
                realRun();
                } catch (OutOfMemoryError e) {

Modified: trunk/freenet/src/freenet/node/SSKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertSender.java 2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/SSKInsertSender.java 2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -101,7 +101,7 @@
     }

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
         short origHTL = htl;
         node.addInsertSender(myKey, htl, this);
         try {

Modified: trunk/freenet/src/freenet/node/TestnetHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/TestnetHandler.java  2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/TestnetHandler.java  2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -75,7 +75,7 @@
        private int testnetPort;

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
                while(true){
                        // Set up server socket
                        try {
@@ -129,7 +129,7 @@
                }

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        InputStream is = null;
                        OutputStream os = null;

Modified: trunk/freenet/src/freenet/node/TestnetStatusUploader.java
===================================================================
--- trunk/freenet/src/freenet/node/TestnetStatusUploader.java   2007-09-03 
23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/TestnetStatusUploader.java   2007-09-03 
23:15:32 UTC (rev 14949)
@@ -45,7 +45,7 @@
        private Socket client;

        public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        //thread loop

                        while(true){

Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-09-03 
23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-09-03 
23:15:32 UTC (rev 14949)
@@ -95,7 +95,7 @@
     }

     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
        try {
                realRun();
        } catch (IOException e) {
@@ -338,7 +338,7 @@
        // FIXME run on separate thread
        n.ps.queueTimedJob(new Runnable() {
                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        n.getNodeUpdater().arm();
                }
        }, 0);

Modified: trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java   
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/TextModeClientInterfaceServer.java   
2007-09-03 23:15:32 UTC (rev 14949)
@@ -208,7 +208,7 @@
      * Read commands, run them
      */
     public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
        while(true) {
                int curPort = port;
                String tempBindTo = this.bindTo;

Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java   
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java   
2007-09-03 23:15:32 UTC (rev 14949)
@@ -27,7 +27,7 @@
        }

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
                try {
                        realRun();
                } catch (IOException e) {

Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java  
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionOutputHandler.java  
2007-09-03 23:15:32 UTC (rev 14949)
@@ -26,7 +26,7 @@
        }

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
                try {
                        realRun();
                } catch (IOException e) {

Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java   2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java   2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -151,7 +151,7 @@
        }

        public void run() {
-           freenet.support.OSThread.logPID(this);
+           freenet.support.Logger.OSThread.logPID(this);
                while(true) {
                        try {
                                realRun();
@@ -526,7 +526,7 @@
                }

                public void run() {
-                   freenet.support.OSThread.logPID(this);
+                   freenet.support.Logger.OSThread.logPID(this);
                        while(true) {
                                long startTime = System.currentTimeMillis();
                                try {

Modified: trunk/freenet/src/freenet/support/Logger.java
===================================================================
--- trunk/freenet/src/freenet/support/Logger.java       2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/support/Logger.java       2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -1,5 +1,12 @@
 package freenet.support;

+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.regex.PatternSyntaxException;
+
 import freenet.support.LoggerHook.InvalidThresholdException;

 /**
@@ -10,6 +17,182 @@

        /** These indicate the verbosity levels for calls to log() * */

+       public final static class OSThread {
+               
+               public static boolean getPIDEnabled = false;
+               public static boolean getPPIDEnabled = false;
+               public static boolean logToFileEnabled = false;
+               public static int logToFileVerbosity = DEBUG;
+               public static boolean logToStdOutEnabled = false;
+               public static boolean procSelfStatEnabled = false;
+       
+               /**
+                * Get the thread's process ID or return -1 if it's unavailable 
for some reason
+                */
+               public synchronized static int getPID(Object o) {
+                       if(!getPIDEnabled) {
+                               return -1;
+                       }
+                       return getPIDFromProcSelfStat(o);
+               }
+       
+               /**
+                * Get the thread's parent process ID or return -1 if it's 
unavailable for some reason
+                */
+               public synchronized static int getPPID(Object o) {
+                       if(!getPPIDEnabled) {
+                               return -1;
+                       }
+                       return getPPIDFromProcSelfStat(o);
+               }
+       
+               /**
+                * Get a specified field from /proc/self/stat or return null if
+                * it's unavailable for some reason.
+                */
+               public synchronized static String getFieldFromProcSelfStat(int 
fieldNumber, Object o) {
+                       String readLine = null;
+       
+                       if(!procSelfStatEnabled) {
+                               return null;
+                       }
+       
+                       // read /proc/self/stat and parse for the specified 
field
+                       BufferedReader br = null;
+                       FileReader fr = null;
+                       File procFile = new File("/proc/self/stat");
+                       if(procFile.exists()) {
+                               try {
+                                       fr = new FileReader(procFile);
+                                       br = new BufferedReader(fr);
+                               } catch (FileNotFoundException e1) {
+                                       logStatic(o, "'/proc/self/stat' not 
found", logToFileVerbosity);
+                                       procSelfStatEnabled = false;
+                                       fr = null;
+                               }
+                               if(null != br) {
+                                       try {
+                                               readLine = br.readLine();
+                                       } catch (IOException e) {
+                                               error(o, "Caught IOException in 
br.readLine() of OSThread.getFieldFromProcSelfStat()", e);
+                                               readLine = null;
+                                       }
+                                       if(null != readLine) {
+                                               try {
+                                                       String[] procFields = 
readLine.trim().split(" ");
+                                                       if(4 <= 
procFields.length) {
+                                                               return 
procFields[ fieldNumber ];
+                                                       }
+                                               } catch (PatternSyntaxException 
e) {
+                                                       error(o, "Caught 
PatternSyntaxException in readLine.trim().split(\" \") of 
OSThread.getFieldFromProcSelfStat() while parsing '"+readLine+"'", e);
+                                               }
+                                       }
+                               }
+                       }
+                       return null;
+               }
+       
+               /**
+                * Get the thread's process ID using the /proc/self/stat method 
or
+                * return -1 if it's unavailable for some reason.  This is an 
ugly
+                * hack required by Java to get the OS process ID of a thread on
+                * Linux without using JNI.
+                */
+               public synchronized static int getPIDFromProcSelfStat(Object o) 
{
+                       int pid = -1;
+       
+                       if(!getPIDEnabled) {
+                               return -1;
+                       }
+                       if(!procSelfStatEnabled) {
+                               return -1;
+                       }
+                       String pidString = getFieldFromProcSelfStat(0, o);
+                       if(null == pidString) {
+                               return -1;
+                       }
+                       try {
+                               pid = Integer.parseInt( pidString.trim() );
+                       } catch (NumberFormatException e) {
+                               error(o, "Caught NumberFormatException in 
Integer.parseInt() of OSThread.getPIDFromProcSelfStat() while parsing 
'"+pidString+"'", e);
+                       }
+                       return pid;
+               }
+       
+               /**
+                * Get the thread's parent process ID using the /proc/self/stat
+                * method or return -1 if it's unavailable for some reason.  
This
+                * is ugly hack required by Java to get the OS parent process 
ID of
+                * a thread on Linux without using JNI.
+                */
+               public synchronized static int getPPIDFromProcSelfStat(Object 
o) {
+                       int ppid = -1;
+       
+                       if(!getPPIDEnabled) {
+                               return -1;
+                       }
+                       if(!procSelfStatEnabled) {
+                               return -1;
+                       }
+                       String ppidString = getFieldFromProcSelfStat(3, o);
+                       if(null == ppidString) {
+                               return -1;
+                       }
+                       try {
+                               ppid = Integer.parseInt( ppidString.trim() );
+                       } catch (NumberFormatException e) {
+                               error(o, "Caught NumberFormatException in 
Integer.parseInt() of OSThread.getPPIDFromProcSelfStat() while parsing 
'"+ppidString+"'", e);
+                       }
+                       return ppid;
+               }
+       
+               /**
+                * Log the thread's process ID or return -1 if it's unavailable 
for some reason
+                */
+               public synchronized static int logPID(Object o) {
+                       if(!getPIDEnabled) {
+                               return -1;
+                       }
+                       int pid = getPID(o);
+                       String msg;
+                       if(-1 != pid) {
+                               msg = "This thread's OS PID is " + pid;
+                       } else {
+                               msg = "This thread's OS PID could not be 
determined";
+                       }
+                       if(logToStdOutEnabled) {
+                               System.out.println(msg + ": " + o);
+                       }
+                       if(logToFileEnabled) {
+                               logStatic(o, msg, logToFileVerbosity);
+                       }
+                       return pid;
+               }
+       
+               /**
+                * Log the thread's process ID or return -1 if it's unavailable 
for some reason
+                */
+               public synchronized static int logPPID(Object o) {
+                       if(!getPPIDEnabled) {
+                               return -1;
+                       }
+                       int ppid = getPPID(o);
+                       String msg;
+                       if(-1 != ppid) {
+                               msg = "This thread's OS PPID is " + ppid;
+                       } else {
+                               msg = "This thread's OS PPID could not be 
determined";
+                       }
+                       if(logToStdOutEnabled) {
+                               System.out.println(msg + ": " + o);
+                       }
+                       if(logToFileEnabled) {
+                               logStatic(o, msg, logToFileVerbosity);
+                       }
+                       return ppid;
+               }
+       }
+
        /** This message indicates an error which prevents correct 
functionality* */
        public static final int ERROR = 16;


Modified: trunk/freenet/src/freenet/support/OSThread.java
===================================================================
--- trunk/freenet/src/freenet/support/OSThread.java     2007-09-03 23:14:44 UTC 
(rev 14948)
+++ trunk/freenet/src/freenet/support/OSThread.java     2007-09-03 23:15:32 UTC 
(rev 14949)
@@ -1,192 +0,0 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-package freenet.support;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.regex.PatternSyntaxException;
-
-import freenet.support.Logger;
-
-/**
- * Get OS/Thread information using one or more methods
- */
-public class OSThread {
-
-    public static boolean getPIDEnabled = false;
-    public static boolean getPPIDEnabled = false;
-    public static boolean logToFileEnabled = false;
-    public static int logToFileVerbosity = Logger.DEBUG;
-    public static boolean logToStdOutEnabled = false;
-    public static boolean procSelfStatEnabled = false;
-
-    /**
-     * Get the thread's process ID or return -1 if it's unavailable for some 
reason
-     */
-       public synchronized static int getPID(Object o) {
-               if(!getPIDEnabled) {
-                       return -1;
-               }
-               return getPIDFromProcSelfStat(o);
-       }
-
-    /**
-     * Get the thread's parent process ID or return -1 if it's unavailable for 
some reason
-     */
-       public synchronized static int getPPID(Object o) {
-               if(!getPPIDEnabled) {
-                       return -1;
-               }
-               return getPPIDFromProcSelfStat(o);
-       }
-
-    /**
-     * Get a specified field from /proc/self/stat or return null if
-        * it's unavailable for some reason.
-     */
-       public synchronized static String getFieldFromProcSelfStat(int 
fieldNumber, Object o) {
-               String readLine = null;
-
-               if(!procSelfStatEnabled) {
-                       return null;
-               }
-
-               // read /proc/self/stat and parse for the specified field
-               BufferedReader br = null;
-               FileReader fr = null;
-               File procFile = new File("/proc/self/stat");
-               if(procFile.exists()) {
-                       try {
-                               fr = new FileReader(procFile);
-                               br = new BufferedReader(fr);
-                       } catch (FileNotFoundException e1) {
-                               Logger.logStatic(o, "'/proc/self/stat' not 
found", logToFileVerbosity);
-                               procSelfStatEnabled = false;
-                               fr = null;
-                       }
-                       if(null != br) {
-                               try {
-                                       readLine = br.readLine();
-                               } catch (IOException e) {
-                                       Logger.error(o, "Caught IOException in 
br.readLine() of OSThread.getFieldFromProcSelfStat()", e);
-                                       readLine = null;
-                               }
-                               if(null != readLine) {
-                                       try {
-                                               String[] procFields = 
readLine.trim().split(" ");
-                                               if(4 <= procFields.length) {
-                                                       return procFields[ 
fieldNumber ];
-                                               }
-                                       } catch (PatternSyntaxException e) {
-                                               Logger.error(o, "Caught 
PatternSyntaxException in readLine.trim().split(\" \") of 
OSThread.getFieldFromProcSelfStat() while parsing '"+readLine+"'", e);
-                                       }
-                               }
-                       }
-               }
-               return null;
-       }
-
-    /**
-     * Get the thread's process ID using the /proc/self/stat method or
-        * return -1 if it's unavailable for some reason.  This is an ugly
-        * hack required by Java to get the OS process ID of a thread on
-        * Linux without using JNI.
-     */
-       public synchronized static int getPIDFromProcSelfStat(Object o) {
-               int pid = -1;
-
-               if(!getPIDEnabled) {
-                       return -1;
-               }
-               if(!procSelfStatEnabled) {
-                       return -1;
-               }
-               String pidString = getFieldFromProcSelfStat(0, o);
-               if(null == pidString) {
-                       return -1;
-               }
-               try {
-                       pid = Integer.parseInt( pidString.trim() );
-               } catch (NumberFormatException e) {
-                       Logger.error(o, "Caught NumberFormatException in 
Integer.parseInt() of OSThread.getPIDFromProcSelfStat() while parsing 
'"+pidString+"'", e);
-               }
-               return pid;
-       }
-
-    /**
-     * Get the thread's parent process ID using the /proc/self/stat
-        * method or return -1 if it's unavailable for some reason.  This
-        * is ugly hack required by Java to get the OS parent process ID of
-        * a thread on Linux without using JNI.
-     */
-       public synchronized static int getPPIDFromProcSelfStat(Object o) {
-               int ppid = -1;
-
-               if(!getPPIDEnabled) {
-                       return -1;
-               }
-               if(!procSelfStatEnabled) {
-                       return -1;
-               }
-               String ppidString = getFieldFromProcSelfStat(3, o);
-               if(null == ppidString) {
-                       return -1;
-               }
-               try {
-                       ppid = Integer.parseInt( ppidString.trim() );
-               } catch (NumberFormatException e) {
-                       Logger.error(o, "Caught NumberFormatException in 
Integer.parseInt() of OSThread.getPPIDFromProcSelfStat() while parsing 
'"+ppidString+"'", e);
-               }
-               return ppid;
-       }
-
-    /**
-     * Log the thread's process ID or return -1 if it's unavailable for some 
reason
-     */
-       public synchronized static int logPID(Object o) {
-               if(!getPIDEnabled) {
-                       return -1;
-               }
-               int pid = getPID(o);
-               String msg;
-               if(-1 != pid) {
-                       msg = "This thread's OS PID is " + pid;
-               } else {
-                       msg = "This thread's OS PID could not be determined";
-               }
-               if(logToStdOutEnabled) {
-                       System.out.println(msg + ": " + o);
-               }
-               if(logToFileEnabled) {
-               Logger.logStatic(o, msg, logToFileVerbosity);
-               }
-        return pid;
-       }
-
-    /**
-     * Log the thread's process ID or return -1 if it's unavailable for some 
reason
-     */
-       public synchronized static int logPPID(Object o) {
-               if(!getPPIDEnabled) {
-                       return -1;
-               }
-               int ppid = getPPID(o);
-               String msg;
-               if(-1 != ppid) {
-                       msg = "This thread's OS PPID is " + ppid;
-               } else {
-                       msg = "This thread's OS PPID could not be determined";
-               }
-               if(logToStdOutEnabled) {
-                       System.out.println(msg + ": " + o);
-               }
-               if(logToFileEnabled) {
-               Logger.logStatic(o, msg, logToFileVerbosity);
-               }
-        return ppid;
-       }
-}

Modified: trunk/freenet/src/freenet/support/transport/ip/IPAddressDetector.java
===================================================================
--- trunk/freenet/src/freenet/support/transport/ip/IPAddressDetector.java       
2007-09-03 23:14:44 UTC (rev 14948)
+++ trunk/freenet/src/freenet/support/transport/ip/IPAddressDetector.java       
2007-09-03 23:15:32 UTC (rev 14949)
@@ -211,7 +211,7 @@
        }

        public void run() {
-               freenet.support.OSThread.logPID(this);
+               freenet.support.Logger.OSThread.logPID(this);
                while(true) {
                        try {
                                Thread.sleep(interval);


Reply via email to