arranged for per-host classloaders
[org.ibex.jinetd.git] / src / org / ibex / jinetd / Main.java
index 8e4c41b..cdbba4b 100644 (file)
@@ -18,7 +18,7 @@ public class Main {
     public static PrintStream LOGSTREAM;
     public static String defaultDomain;
 
-    static {
+    public static void init() {
         try {
             System.err.println("jinetd starting...");
             ROOT = System.getProperty("jinetd.root", null);
@@ -69,7 +69,16 @@ public class Main {
         System.exit(0);
     }
 
+    private static TreeClassLoader rootClassLoader;
+    public static TreeClassLoader getRootClassLoader() {
+        if (rootClassLoader==null)
+            rootClassLoader = new TreeClassLoader(new File(ROOT + File.separatorChar + "lib"),
+                                                  Main.class.getClassLoader());
+        return rootClassLoader;
+    }
+
     public static void main(String[] s) throws Exception {
+        init();
         Root root = new Root(ROOT);
         while(true) try {
             if (root != null) { root.scan(); return; }