[RFC][plugin]: fix concurrency problems in PAV.java
Deepak Bhole
dbhole at redhat.com
Wed Apr 13 14:10:36 PDT 2011
* 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;
> }
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.
More information about the distro-pkg-dev
mailing list