Startup delay due to ExtensionManager
-------------------------------------

                 Key: FELIX-388
                 URL: https://issues.apache.org/jira/browse/FELIX-388
             Project: Felix
          Issue Type: Improvement
          Components: Framework
            Reporter: Felix Meschberger


The ExtensionManager creates its own URL using itself as the URLStreamHandler. 
The URL is inserted into the URL ClassLoader launching the framework. If a 
resource is to be found using this URL, the equals method is called which 
causes the host name of the URL (extension) to be resolved by 
InetAddress.getByName(name).

As the host is not in any DNS (most probably) and the name does not matter 
anyway, resolution of the host name seems to be overkill and just delay 
operation. To prevent this lookup, I propose to overwrite the 
URLStreamHandler.getHostAddress(URL) in the ExtensionManager to just 
immediately return null:


Index: 
/usr/src/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
===================================================================
--- 
/usr/src/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
       (revision 581194)
+++ 
/usr/src/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
       (working copy)
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.InetAddress;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
@@ -566,4 +567,10 @@
             m_extensions.add(extension);
         }
     }
+    
+    protected InetAddress getHostAddress( URL u )
+    {
+        // the extension URLs do not address real hosts
+        return null;
+    }
 }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to