[RFC][plugin]: fix concurrency problems in PAV.java

Denis Lila dlila at redhat.com
Thu Apr 14 07:01:15 PDT 2011


> Does it only ever store AVPs?

It only ever stores NetxPanels which is a descendant of AVP.

> And, most importantly, are there casts which assume AVPs
> are stored there?

There are no casts associated with this vector at all (except
the invisible ones necessitated by type erasure of generics).

> If only the former is true, it would strengthen the type requirements
> of the collection to a specific subtype so you must be sure that's
> what you want and that you don't ever want to store a different
> subtype or instances of the more general type.

That's true. Even though the vector only contains NetxPanels, I see
no reason to make that a requirement by changing the type. We only
use it for the "applet" field of it's elements, and Vector<AppletPanel>
is enough for us to get that field.

Regards,
Denis.

----- Original Message -----
> On 09:45 Thu 14 Apr , Denis Lila wrote:
> > > Instead of doing this, it would be easier to change the type of
> > > appletPanels to Vector<AppletViewerPanel> , then the casting is
> > > not
> > > needed as AVP inherits from AP.
> >
> > The casting to AppletViewerPanel is not caused by appletPanels. It
> > is caused by the "panel" member. It used to be declared as an AVP,
> > then I changed it to a NetxPanel, which made the 3 new casts
> > necessary (but it eliminated many more casts than it added).
> >
> > That said, I wouldn't mind changing the type of appletPanels
> > to Vector<AVP>. Do you still think I should?
> >
> 

> 

> 
> > Thank you,
> > Denis.
> >
> > ----- Original Message -----
> > > * Denis Lila <dlila at redhat.com> [2011-04-13 15:10]:
> > > > > If a patch akin to
> > > > > http://hg.openjdk.java.net/jdk6/jdk6/langtools/rev/5c2858bccb3f
> > > > > goes in, I will not be responsible for my actions.
> > > >
> > > > I definitely don't want that ;-).
> > > >
> > > > Attached is the second patch. It's mostly cleanup, and it
> > > > also uses "pav" in destroyApplet, instead of calling
> > > > get(id) again and again.
> > > >
> > > > Ok to push?
> > > >
> > >
> > > ...
> > > ...
> > >
> > > <snip>
> > > >
> > > >              PluginDebug.debug("getCachedImageRef() getting img
> > > >              from
> > > >              URL = ", url);
> > > > @@ -910,8 +815,8 @@
> > > >          SocketPermission panelSp =
> > > >                  new
> > > >                  SocketPermission(panel.getCodeBase().getHost(),
> > > >                  "connect");
> > > >          synchronized(appletPanels) {
> > > > - for (Enumeration e = appletPanels.elements();
> > > > e.hasMoreElements();) {
> > > > - AppletPanel p = (AppletPanel) e.nextElement();
> > > > + for (Enumeration<AppletPanel> e = appletPanels.elements();
> > > > e.hasMoreElements();) {
> > > > + AppletPanel p = e.nextElement();
> > > >                  String param = p.getParameter("name");
> > > >                  if (param != null) {
> > > >                      param = param.toLowerCase();
> > > > @@ -1591,15 +1496,15 @@
> > > >           * at the same time.
> > > >           */
> > > >          try {
> > > > - panel.joinAppletThread();
> > > > - panel.release();
> > > > + ((AppletViewerPanel)panel).joinAppletThread();
> > > > + ((AppletViewerPanel)panel).release();
> > > >          } catch (InterruptedException e) {
> > > >              return; // abort the reload
> > > >          }
> > > >
> > > >          AccessController.doPrivileged(new
> > > >          PrivilegedAction<Void>()
> > > >          {
> > > >              public Void run() {
> > > > - panel.createAppletThread();
> > > > + ((AppletViewerPanel)panel).createAppletThread();
> > > >                  return null;
> > > >              }
> > >
> > >
> >
> 
> --
> Andrew :)
> 
> Free Java Software Engineer
> Red Hat, Inc. (http://www.redhat.com)
> 
> Support Free Java!
> Contribute to GNU Classpath and IcedTea
> http://www.gnu.org/software/classpath
> http://icedtea.classpath.org
> PGP Key: F5862A37 (https://keys.indymedia.org/)
> Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37



More information about the distro-pkg-dev mailing list