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

Denis Lila dlila at redhat.com
Thu Apr 14 06:45:04 PDT 2011


> 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;
> >              }
> 
> 




More information about the distro-pkg-dev mailing list