From 34995dfe086e30267dd367f65eaa45144235b069 Mon Sep 17 00:00:00 2001 From: Adam Domurad Date: Fri, 18 May 2012 09:27:24 -0400 Subject: 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. --- plugin/icedteanp/java/sun/applet/PluginStreamHandler.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'plugin/icedteanp/java') diff --git a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java index c8a4aec..0bb1f01 100644 --- a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java +++ b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java @@ -59,7 +59,7 @@ public class PluginStreamHandler { 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 @@ public class PluginStreamHandler { 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 @@ public class PluginStreamHandler { } 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 -- cgit v1.2.3