changeset 374:b67e12ff7837

Removal of synchronization on Boolean in PluginStreamHandler. Synchronization on Boolean is dangerous and was unnecessary in this context. As well, the Boolean flag that was being used during shut down was changed to a volatile boolean so changes could be seen without synchronization.
author Adam Domurad <adomurad@redhat.com>
date Fri, 18 May 2012 09:27:24 -0400
parents 7151720a2f5b
children bcaec1cfd8f2
files plugin/icedteanp/java/sun/applet/PluginStreamHandler.java
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java	Thu May 17 14:14:03 2012 -0400
+++ b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java	Fri May 18 09:27:24 2012 -0400
@@ -59,7 +59,7 @@
     private JavaConsole console = new JavaConsole();
 
     private PluginMessageConsumer consumer;
-    private Boolean shuttingDown = false;
+    private volatile boolean shuttingDown = false;
 
 
     public PluginStreamHandler(InputStream inputstream, OutputStream outputstream)
@@ -322,9 +322,7 @@
             PluginDebug.debug("  PIPE: appletviewer read: ", message);
 
             if (message == null || message.equals("shutdown")) {
-                synchronized (shuttingDown) {
-                    shuttingDown = true;
-                }
+                shuttingDown = true;
                 try {
                     // Close input/output channels to plugin.
                     pluginInputReader.close();
@@ -362,10 +360,8 @@
             } catch (IOException e) {
                 // if we are shutting down, ignore write failures as 
                 // pipe may have closed
-                synchronized (shuttingDown) {
-                    if (!shuttingDown) {
-                        e.printStackTrace();
-                    }
+                if (!shuttingDown) {
+                    e.printStackTrace();
                 }
 
                 // either ways, if the pipe is broken, there is nothing