Skip to main content

Performance issues with unneded class downloading

No replies
maxz1
Offline
Joined: 2006-01-10

I have applet which works in a quite slow network and have
performace issues during its startup. The issues are described below:

Issue 1 (2 round-trips per resource)
----------------------------------------
When I start applet it checks if there is a new version
of JAR file on the server. If there is a new version
it downloads it. In my case I have no a new version
on server and applet should only do verification request.

Hovewer when I switch on network tracing in Java
plug-in console I get the following 2 records:

network: Connecting http://myserver/applet-dir/myapplet.jar with proxy=DIRECT
network: Connecting http://myserver/applet-dir/myapplet.jar with cookie "JSESSIONID=..."

The question is why there are two attempts to connect server?
Why it can not just do it with one request? Does it depend
on Network proxy settings?

Issue 2 (Attempt to load classes from remote code base)
----------------------------------------
After myapplet.jar is checked for updates the AppletClassLoader
also attepmts to load some additional classes from applet
base URL. In the network traces it looks like this:

network: Connecting http://myserver/applet-dir/commons-logging.properties with proxy=DIRECT
network: Connecting http://myserver/applet-dir/commons-logging.properties with cookie "JSESSIONID=..."
network: Connecting http://myserver/applet-dir/META-INF/services/org.apache.commons.logging.... with proxy=DIRECT
network: Connecting http://myserver/applet-dir/META-INF/services/org.apache.commons.logging.... with cookie "JSESSIONID=..."
network: Connecting http://myserver/applet-dir/PatternLayoutBeanInfo.class with proxy=DIRECT
network: Connecting http://myserver/applet-dir/PatternLayoutBeanInfo.class with cookie "JSESSIONID=..."

All of the classses/resources commons-logging.properties, LogFactory, PatternLayoutBeanInfo
are not avaliable at the URL's shown in the trace but it takes time
for checking if it is so.

I've figured out that the problem is connected with Class.forName("") call in
applet code. Some libraries (like commons logging) check is class or resource is
available this way. If resource/class is not available then the library can continue
working anyway but checking takes time!!!

Looking at forum posts I've found similar bug description here:
http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4668479

In the "Evaluation" of the bug section has the following text:

"- AppletClassLoader could provide an option to tag a jar file as
containing the complete applet. This could, for example, take the form
of a flag in the jar file manifest. With this option set, the class
loader would immediately fail a class/resource lookup if the
class/resource isn't found in the jar file itself, rather than going
back to the applet's code base."

It is also declared that the bug is fixed in Mustang (JRE1.6) but there
is nothing said about how it is fixed.

The question is: I'd like to know if there is any possiblity to deny
class/resource loading from applet's code base? In which JRE version?
Are there any documentation describing that?

I appreciate your help,
thanks in advance.
Maxim