Re: Applets running in different thread groups under Plugin

From: rpadev (rpadev_at_nospam.optonline.net)
Date: 03/19/04


Date: Fri, 19 Mar 2004 15:36:32 GMT


"John C. Bollinger" <jobollin@indiana.edu> wrote in
news:c3cnrs$g6k$1@hood.uits.indiana.edu:

> John Raggio wrote:
>
>> We have an application that uses multiple applets in frames. We
>> noticed that when we open the frameset that some of the applets run
>> in different thread groups. This would not be a big deal, but we
>> find that the applets in different groups can no longer communicate
>> via static methods the way they do when running in the same group.
>> We
>
> Being in different thread groups should not interfere with access to
> shared variable and static methods.
>
>> have done nothing in our code to place them in groups so why is this
>> happening?
>
> Evidently your browser / VM implementation is doing it. I would guess
> that the thread grouping is not really the core issue here.
>
>> Can it be avoided?
>
> It is unlikely that it can be avoided from the Java side, but it could
> potentially be avoided by changes to the page / frameset in which the
> applets are presented. It is conceivable that the VM or browser could
> be configured differently as well, but I wouldn't hold out too much
> hope for that.
>
>> The applets also use helper threads and we find that each of the
>> groups has instances of the helper threads even though we have tried
>> to ensure that these are singletons.
>>
>> The applets are behaving as if they are running in their own VM.
>
> Or as if they were loaded by different ClassLoaders.
>
>> If
>> there are multiple VMs would I see additional plugin icons (coffee
>> cups) in the task bar? I only see one.
>
> I typically do see multiple plugin icons in the task bar when multiple
> copies of the plugin are running, but I wouldn't count on that as a
> sure diagnostic. Nevertheless, chances are that your applets are
> being loaded by different ClassLoaders, one per frame in your
> frameset. Classes are scoped to the ClassLoader that loads them, so
> two copies of the same class loaded by different loaders are
> effectively different classes. It is arguably the desired behavior
> (in most cases) to isolate applets running in different frames from
> each other, so loading them with different loaders would make sense.
>
> You have relatively few options for inter-applet communication:
> (1) Use the server to establish a message queue
> (2) Put all the applets in the same page, displayed in only one frame
> of your frameset, and cross your fingers.
> (3) Make your applets trusted (by signing their jars) and communicate
> via local sockets or (less preferred) via the local filesystem.
>
> There may be other options, but the ones above are probably your best
> bets.
>
>
> John Bollinger
> jobollin@indiana.edu
>
>

John:

Thanks for your time and the lengthy resonse. You hit the nail on the
head. I was going to post a follow up myself this morning. One of the
applets was loaded into a different classloader which is why it was in
its own thread group. Apparently applets will be loaded into a different
classloader if they are from a different codebase. We thought ours were
in the same codebase all along, but after looking at the html we found
that the wayward applet had an extra space in its <Archive> tag. It had
the exact same set of jars (in the same order even), but the string had
an extra space. I can't belive that the plugin does a string compare to
determine if applets arein the same codebase, but alas that was the
cause.

Thanks,
John



Relevant Pages

  • Re: Applets in Sharepoint
    ... would say no based on the fact that is spawns new frames. ... > find out whether applets can be executed within a Sharepoint Web part. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Print from applets - again !
    ... Doesn't WebStart launch the applets standalone, ... a web-page with 4 frames, one of the frames contain the applet, the other ... frames standard HTML. ...
    (comp.lang.java.help)
  • Re: Java Applet not working in web browser
    ... Having experience with both applets, ... frames launched using web start* (from ... a browser link), I would recommend web start and frame. ... How doe eclipse run the applet? ...
    (comp.lang.java.programmer)
  • applets and frames
    ... Internet explorer IE7 will not work with applets and or Frames on pages ... created with FrontPage 2003 ... Kurt Knoll ...
    (microsoft.public.frontpage.programming)
  • Re: Applets running in different thread groups under Plugin
    ... John Raggio wrote: ... > that the applets in different groups can no longer communicate via ... Being in different thread groups should not interfere with access to ... potentially be avoided by changes to the page / frameset in which the ...
    (comp.lang.java.programmer)