http-client-branch: race condition in RedirectMethodChange test http-client-branch
authormichaelm
Tue, 13 Mar 2018 17:37:30 +0000
branchhttp-client-branch
changeset 56298 81d4669da207
parent 56297 5cb14c44639b
child 56299 903ff8ec239d
http-client-branch: race condition in RedirectMethodChange test
test/jdk/java/net/httpclient/RedirectMethodChange.java
--- a/test/jdk/java/net/httpclient/RedirectMethodChange.java	Tue Mar 13 17:23:42 2018 +0000
+++ b/test/jdk/java/net/httpclient/RedirectMethodChange.java	Tue Mar 13 17:37:30 2018 +0000
@@ -246,8 +246,8 @@
      */
     static class RedirMethodChgeHandler implements HttpTestHandler {
 
-        volatile boolean inTest;
-        volatile String expectedMethod;
+        boolean inTest;
+        String expectedMethod;
 
         final String targetURL;
         RedirMethodChgeHandler(String targetURL) {
@@ -272,7 +272,7 @@
         }
 
         @Override
-        public void handle(HttpTestExchange he) throws IOException {
+        public synchronized void handle(HttpTestExchange he) throws IOException {
             boolean newtest = he.getRequestURI().getPath().endsWith("/test/rmt");
             if ((newtest && inTest) || (!newtest && !inTest)) {
                 Throwable ex = new RuntimeException("Unexpected newtest:" + newtest