Author: nextgens
Date: 2006-07-26 12:37:54 +0000 (Wed, 26 Jul 2006)
New Revision: 9769

Modified:
   trunk/freenet/src/freenet/node/Node.java
Log:
Having two different starting method is just silly and might lead to weird, 
unreproductible bug reports ; let's simplify it

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2006-07-26 12:18:56 UTC (rev 
9768)
+++ trunk/freenet/src/freenet/node/Node.java    2006-07-26 12:37:54 UTC (rev 
9769)
@@ -909,87 +909,7 @@
         * Anything that needs static init should ideally be in here.
         */
        public static void main(String[] args) throws IOException {
-               if(args.length>1) {
-                       System.out.println("Usage: $ java freenet.node.Node 
<configFile>");
-                       return;
-               }
-               
-               File configFilename;
-               if(args.length == 0) {
-                       System.out.println("Using default config filename 
freenet.ini");
-                       configFilename = new File("freenet.ini");
-               } else
-                       configFilename = new File(args[0]);
-                       
-               // set Java's DNS cache not to cache forever, since many people
-               // use dyndns hostnames
-               java.security.Security.setProperty("networkaddress.cache.ttl" , 
"0");
-               
java.security.Security.setProperty("networkaddress.cache.negative.ttl" , "0");
-               
-               FilePersistentConfig cfg = new 
FilePersistentConfig(configFilename);
-               
-               // First, set up logging. It is global, and may be shared 
between several nodes.
-               
-               SubConfig loggingConfig = new SubConfig("logger", cfg);
-               
-               try {
-                       logConfigHandler = new 
LoggingConfigHandler(loggingConfig);
-               } catch (InvalidConfigValueException e) {
-                       System.err.println("Error: could not set up logging: 
"+e.getMessage());
-                       e.printStackTrace();
-                       return;
-               }
-               
-               // Setup RNG
-
-               RandomSource random = new Yarrow();
-               
-               DiffieHellman.init(random);
-               
-               /*
-               SimpleToadletServer server = new SimpleToadletServer(port+2000);
-               FProxyToadlet fproxy = new 
FProxyToadlet(n.makeClient(RequestStarter.INTERACTIVE_PRIORITY_CLASS));
-               PProxyToadlet pproxy = new 
PProxyToadlet(n.makeClient(RequestStarter.INTERACTIVE_PRIORITY_CLASS), 
n.pluginManager);
-               server.register(fproxy, "/", false);
-               server.register(pproxy, "/plugins/", true);
-               
-               System.out.println("Starting FProxy on port "+(port+2000));
-               new FCPServer(port+3000, n);
-               System.out.println("Starting FCP server on port "+(port+3000));
-               //server.register(fproxy, "/SSK@", false);
-               //server.register(fproxy, "/KSK@", false);
-               */
-               Node node;
-               try {
-                       node = new Node(cfg, random, logConfigHandler);
-                       node.start(false);
-               } catch (NodeInitException e) {
-                       System.err.println("Failed to load node: 
"+e.getMessage());
-                       e.printStackTrace();
-                       System.exit(e.exitCode);
-               }
-
-               // Thread to keep the node up.
-               // JVM deadlocks losing a lock when two threads of different 
types (daemon|app)
-               // are contended for the same lock. So make USM daemon, and use 
useless to keep the JVM
-               // up.
-               // 
http://forum.java.sun.com/thread.jspa?threadID=343023&messageID=2942637 - last 
message
-               Runnable useless =
-                       new Runnable() {
-                       public void run() {
-                               while(true)
-                                       try {
-                                               Thread.sleep(Long.MAX_VALUE);
-                                       } catch (InterruptedException e) {
-                                               // Ignore
-                                       }
-                       }
-               };
-               Thread plug = new Thread(useless, "Plug");
-               // Don't setDaemon as this thread doesn't do anything, and we 
need one non-daemon thread to keep the JVM alive.
-               plug.start();
-               
-
+               NodeStarter.main(args);
        }

        static class NodeInitException extends Exception {


Reply via email to