Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv22945/src/freenet

Modified Files:
      Tag: ngrouting
        Core.java 
Log Message:
Fix for class initialization order, see Sun BugID 4419673 for a discussion around the 
issue

Index: Core.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Core.java,v
retrieving revision 1.39
retrieving revision 1.39.2.1
diff -u -r1.39 -r1.39.2.1
--- Core.java   3 Jul 2003 03:33:41 -0000       1.39
+++ Core.java   26 Aug 2003 23:04:35 -0000      1.39.2.1
@@ -31,7 +31,7 @@
 
 public class Core {
 
-    public static final Config config = new Config();
+    private static final Config config = new Config();
     
     static {
         config.addOption("authTimeout",            1, 30000,  3100); // 30 sec
@@ -183,6 +183,28 @@
 
     /** Distribution of successful inbound InsertRequests over the keyspace **/
     public static KeyHistogram successInsertDistribution = null;
+
+       /**
+        * @return
+        */
+       public static Config getConfig() {
+               
+               try {
+                       //Enforce initialization of all of the 'freenet.node.Node' 
class:s static fields and scopes
+                       //'freenet.node.Node' uses static initialization to set up 
some config parameters,
+                       //this call forces this to happen *before* the first 
instanciation of 'freenet.node.Node' 
+                       //As of now (2003-08-27) 'freenet.node.Main' uses static 
members of 'freenet.node.Node'
+                       //before the first instanciation which wont work without this 
call 
+                       //Have a look at Sun BugID 4419673 for details.
+                       //TODO: Remove this hack when initialization order (or 
something) is changed
+                       Class.forName("freenet.node.Node"); 
+                        
+               } catch (ClassNotFoundException e) {
+                       //Really baaaad.. maybe someone renamed this class
+                       e.printStackTrace();
+               }
+               return config;
+       }
 
     /**
      * Returns the probability of success of a request that would go into

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to