>
>
> Miguel wrote:
>
>> The initialization is only going to happen when the class loads.
>>
>> The class is only going to get loaded once.
>>
>> The first thread to reference the class will load the class. The second
>> thread will not reload the class because the class was already loaded.
>> So
>> the static variables will not get re-initialized and overwritten.
>>
>
> OK, I think I get that. Then the problem was just that the first
> applet created the matrix, and the second changed its contents WHILE
> the first one was executing.

Yes

> That certainly explains the result for
> two applets on the same page -- one isosurface being offset in one
> applet just because a second applet is right behind it creating its
> own isosurface with a different matrix.
>
> So if you have an array, say:
>
> final static Point3f[] myArray  = new Point3f[10];
>
> the first applet hitting that sets all the points to {0,0,0}, but the
> next one will not initialize, and so it will find whatever values were
> left there from the previous applet?

Correct

> I guess that makes sense. Oh so tricky, though.

Yes.

Safest thing is to stay away from static object variables.

I probably did us all a disservice by introducing them. The amout of
time/memory that I *saved* has been squandered by the problems raised in
these discussions ;-)

> What sort of problems should we expect for two different pages pulling
> up two different versions of Jmol?


** time spent thinking ***

I have rethought my answer on that ...

The JVM *must* segregate two classes with the same name coming from
different web servers. Not doing so would be a major security problem.

** 5 minutes later **

I was only able to find a relatively obscure reference in the Plug-in
documentation that says that the ClassLoader will only share classes if
they come from the same codebase.

So, we should not have problems with different versions of Jmol*.jar
coming from different web sites.


Miguel



_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to