I am profiling a java applet startup time. I have noticed that a huge jar of size 5MB is fully read every time a resource from the jar is requested. E.g. images log configuration files, I18N files etc.... Should it behave that way? Is it possible just to jump to the correct point ? Is it possible to read the file only once? If I will switch to cache_archiv_ex and add a preload directive will it help? Example of where the jar file is opened:
java.io.FileInputStream.open(String)
java.io.FileInputStream.<init>(File)
com.sun.deploy.cache.DeployCacheHandler$2.run()
java.security.AccessController.doPrivileged(PrivilegedExceptionAction)
com.sun.deploy.cache.DeployCacheHandler.get(URI, String, Map)
sun.net.www.protocol.http.HttpURLConnection.plainConnect()
sun.net.www.protocol.http.HttpURLConnection.connect()
sun.net.www.protocol.http.HttpURLConnection.getInputStream()
sun.plugin.PluginURLJarFileCallBack.downloadJAR(URLConnection, boolean)
sun.plugin.PluginURLJarFileCallBack.access$000(PluginURLJarFileCallBack, URLConnection, boolean)
sun.plugin.PluginURLJarFileCallBack$2.run()
java.security.AccessController.doPrivileged(PrivilegedExceptionAction)
sun.plugin.PluginURLJarFileCallBack.retrieve(URL)
sun.net.www.protocol.jar.URLJarFile.retrieve(URL, URLJarFile$URLJarFileCloseController)
sun.net.www.protocol.jar.URLJarFile.getJarFile(URL, URLJarFile$URLJarFileCloseController)
sun.net.www.protocol.jar.JarFileFactory.get(URL, boolean)
sun.net.www.protocol.jar.JarURLConnection.connect()
sun.plugin.net.protocol.jar.CachedJarURLConnection.connect()
sun.plugin.net.protocol.jar.CachedJarURLConnection.getInputStream()
java.net.URL.openStream()
java.lang.ClassLoader.getResourceAsStream(String)
sun.plugin2.applet.Applet2ClassLoader.getResourceAsStream(String)
..
.. (real application code stack...)
..
..
java.awt.event.InvocationEvent.dispatch()
java.awt.EventQueue.dispatchEvent(AWTEvent)
java.awt.EventDispatchThread.pumpOneEventForFilters(int)
java.awt.EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter)
java.awt.EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component)
java.awt.EventDispatchThread.pumpEvents(int, Conditional)
java.awt.EventDispatchThread.pumpEvents(Conditional)
java.awt.EventDispatchThread.run()