test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003a.java
changeset 53960 6c3fd94de35a
parent 50018 3ba0d8631f24
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003a.java	Thu Feb 28 12:05:59 2019 -0800
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003a.java	Thu Feb 28 13:12:26 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,17 +126,26 @@
                          }
                          log1("mainThread is out of: synchronized (lockingObject)");
 
-                         instruction = pipe.readln();
-                         if (!instruction.equals("check_alive")) {
-                             logErr("ERROR: unexpected instruction: " + instruction);
-                             exitCode = FAILED;
-                         } else {
-                             log1("checking on: thread2.isAlive");
-                             if (test_thread.isAlive()) {
-                                 test_thread.resume();
-                                 pipe.println("alive");
+                         while (true) {
+                             instruction = pipe.readln();
+                             if (instruction.equals("check_done")) {
+                                 if (test_thread.isAlive()) {
+                                     logErr("ERROR: thread2 thread is still alive");
+                                     exitCode = FAILED;
+                                 }
+                                 break;
+                             } else if (instruction.equals("check_alive")) {
+                                 log1("checking on: thread2.isAlive");
+                                 if (test_thread.isAlive()) {
+                                     test_thread.resume();
+                                     pipe.println("alive");
+                                 } else {
+                                     pipe.println("not_alive");
+                                 }
                              } else {
-                                 pipe.println("not_alive");
+                                 logErr("ERROR: unexpected instruction: " + instruction);
+                                 exitCode = FAILED;
+                                 break;
                              }
                          }