8081634: Concurrent usage of a StringBuilder causes test intermittent failures
authorjbachorik
Mon, 22 Jun 2015 12:13:39 +0200
changeset 31458 4a8674cc6f9e
parent 31457 fa81a65e236d
child 31459 ce31ebbfa204
8081634: Concurrent usage of a StringBuilder causes test intermittent failures Reviewed-by: sla, sspitsyn
jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java
--- a/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java	Tue Jun 16 16:36:27 2015 +0300
+++ b/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java	Mon Jun 22 12:13:39 2015 +0200
@@ -196,7 +196,9 @@
             l.addToolArg(cmd);
         }
 
-        StringBuilder output = new StringBuilder();
+        // this buffer will get filled in different threads
+        //   -> must be the synchronized StringBuffer
+        StringBuffer output = new StringBuffer();
 
         AtomicBoolean portUnavailable = new AtomicBoolean(false);
         Process p = ProcessTools.startProcess(