test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java
changeset 53960 6c3fd94de35a
parent 53869 34906de6c017
equal deleted inserted replaced
53959:1542e63eb537 53960:6c3fd94de35a
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 package nsk.jdi.VirtualMachine.dispose;
    24 package nsk.jdi.VirtualMachine.dispose;
    25 
    25 
       
    26 import jdk.test.lib.Utils;
    26 import nsk.share.*;
    27 import nsk.share.*;
    27 import nsk.share.jpda.*;
    28 import nsk.share.jpda.*;
    28 import nsk.share.jdi.*;
    29 import nsk.share.jdi.*;
    29 
    30 
    30 import com.sun.jdi.*;
    31 import com.sun.jdi.*;
   259                 }
   260                 }
   260 
   261 
   261                 if (expresult != returnCode0)
   262                 if (expresult != returnCode0)
   262                     break label1;
   263                     break label1;
   263 
   264 
   264                 log2("      Thread.sleep(waitTime*60000);");
   265                 log2("      Waiting for thread2 is not alive");
   265                 try {
   266 
   266                     Thread.sleep(waitTime*60000);
   267                 Utils.waitForCondition(
   267                 } catch ( InterruptedException e ) {
   268                         () -> {
   268                     log3("ERROR: InterruptedException");
   269                             log2("......sending to the debuggee: 'check_alive'");
   269                     expresult = returnCode1;
   270                             log2("       expected reply: 'not_alive'");
   270                     break label1;
   271                             pipe.println("check_alive");
   271                 }
   272                             String reply = pipe.readln();
   272 
   273                             if (reply.equals("alive")) {
   273                 log2("......sending to the debuggee: 'check_alive'");
   274                                 log3("ERROR: thread2 is alive");
   274                 log2("       expected reply: 'not_alive'");
   275                                 return false;
   275                 pipe.println("check_alive");
   276                             } else if (reply.equals("not_alive")) {
   276                 line = pipe.readln();
   277                                 log2("     thread2 is not alive");
   277                 if (line.equals("alive")) {
   278                                 return true;
   278                     log3("ERROR: thread2 is alive");
   279                             } else {
   279                     expresult = returnCode1;
   280                                 log3("ERROR: unexpected reply: " + reply);
   280                 } else if (line.equals("not_alive")) {
   281                                 throw new RuntimeException("ERROR: unexpected reply: " + reply);
   281                     log2("     thread2 is not alive");
   282                             }
   282                 } else {
   283 
   283                     log3("ERROR: unexpected reply: " + line);
   284                         },
   284                     expresult = returnCode4;
   285                         Utils.adjustTimeout(waitTime * 60000),
   285                 }
   286                         1000);
   286 
   287 
       
   288                 pipe.println("check_done");
   287             }
   289             }
   288 
   290 
   289             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   291             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   290         }
   292         }
   291         log1("      TESTING ENDS");
   293         log1("      TESTING ENDS");