changeset 31458:4a8674cc6f9e

8081634: Concurrent usage of a StringBuilder causes test intermittent failures Reviewed-by: sla, sspitsyn
author jbachorik
date Mon, 22 Jun 2015 12:13:39 +0200
parents fa81a65e236d
children ce31ebbfa204
files jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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(