Nicolas Vervelle wrote:
> Bob Hanson wrote:
>
>> Right, so that would be even better, and we can definitely try that.
>>
>>
>> I've run some tests that put different readers in different jar files
>> to see what happens.
>> Here's the problem I see right now:
>>
>> 1) When you load the applet, even if you never ever use any of the
>> classes in a particular
>> jar file, that jar file is still downloaded if it is listed on the
>> class preloader INDEX.LIST.
>> I've tried this several times now with my own webserver, and it's
>> clear that all the jar files
>> are delivered BEFORE the model file is requested. I guess that's what
>> "preloading" is
>> all about, right?
>>
>> So if it's going to be in a jar file, unused classes can't be in Jar
>> files on the INDEX.LIST, I think.
>>
>
> That's not my understanding, but I haven't tested, I have just read
> Sun doc :
> - INDEX.LIST is only a list of which package is in which jar. It's
> only used when trying to find a class, by reading first the jars that
> contain the package.
> - "preloading" is coded in JmolApplet.java (in the default package,
> not in org.jmol....), by providing a list of classes to preload.
>
You are probably right. I'll test again and confirm before I say it is
certain, but here is what I am preloading:
private final static String[] preloadClasses = {
"javax.vecmath.Point3f+",
"javax.vecmath.Vector3f+",
".Matrix3f+", ".Point3i+",
"org.jmol.g3d.Graphics3D",
// "org.jmol.adapter.smarter.SmarterJmolAdapter",
"org.jmol.g3d.Sphere3D",
".Line3D", ".Cylinder3D", ".Colix3D", ".Shade3D",
// "org.jmol.adapter.smarter.Atom",
// ".Bond", ".AtomSetCollection", ".AtomSetCollectionReader",
// ".Resolver",
// "org.jmol.popup.JmolPopup",
};
Here is what the browser is requesting, in order:
JmolApplet0, 1, 3, 2, 6, 4, 5
Then it downloads caffeine.xyz
Now, 5 in particular is curious:
<jar destfile="${jmol.applet.build.dir}/JmolApplet5.jar"
manifest="manifest/applet5.txt" >
<fileset dir="${applet.classes.dir}">
<include name="org/jmol/quantum/**" />
<include name="org/jmol/jvxl/**" />
<include name="org/jmol/shapespecial/**" />
</fileset>
</jar>
When I remove JmolApplet5 from the server, then I see three requests for
the file (which just returns a simple error message) and then it continues.
I'll do another test where I put shapebio in a separate Jar file and see
if it loads that. I KNOW there are no references to shapebio in any code
anywhere -- all those classes are loaded as shapes when necessary.
I think that perhaps any "import" in any class triggers the downloading,
but it must be more than that.
Bob
>> 2) If the jar file is NOT on the list, then that file doesn't load
>> until it is needed. But there's a
>> catch. What happens is that as soon as one item that has not been
>> loaded is requested, then
>> all the remaining Jar files are transferred, because JVM has no idea
>> which jar file to load.
>>
>
> JVM should know in which jar file the class file is because build.xml
> adds this information in JmolApplet0.jar (the index="true" parameter
> for JmolApplet0.jar). The <indexjars> tag should contain all jars.
> That's what creates INDEX.LIST.
>
>
> At least, that's how I think it should work. And that's probably how
> Miguel thought it was working.
> Miguel, do you have more information about this ?
>
>> It just loads them all, or at least until it finds the class it
>> needs. And since a browser may go
>> after its files using multiple simultaneous threads (I see up to FIVE
>> active "users" on my
>> server when just one browser is getting files), I've even seen it
>> look for the class file even though
>> the right jar file is currently being downloaded. These browsers
>> really go all out!
>>
>
> That's really strange.
>
>> HOWEVER,
>>
>> If you instead just supply the class file and no more jar files, then
>> that class file is read immediately.
>> So I think the solution is to simply provide a very light version,
>> with only a miminum set of readers --
>> perhaps even just XYZ -- and let the developer put whatever class
>> file he/she wants on the server
>> along with those.
>>
>
> This is still complex, because the web developer has to take care of
> dependencies (or put all class files).
>
>> I'll do more tests....
>>
>>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers