--- old/test/java/rmi/testlibrary/JavaVM.java 2014-01-26 12:44:08.563658284 +0800 +++ new/test/java/rmi/testlibrary/JavaVM.java 2014-01-26 12:44:08.359658273 +0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -26,6 +26,7 @@ import java.io.OutputStream; import java.util.Arrays; import java.util.StringTokenizer; +import java.util.concurrent.TimeUnit; /** * RMI regression test utility class that uses Runtime.exec to spawn a @@ -173,6 +174,25 @@ } /** + * Causes the current thread to wait the subprocess to exit, if necessary, + * until the subprocess represented by this Process object has terminated, + * or the specified waiting time elapses. + * @param timeout the maximum time to wait + * @param unit the time unit of the timeout argument + * @return true if the JavaVM has exited and false if the waiting time + * elapsed before the subprocess has exited. + * @throws InterruptedException if the current thread is interrupted + * while waiting. + */ + public boolean waitFor(long timeout, TimeUnit unit) + throws InterruptedException { + if (vm == null) + throw new IllegalStateException("can't wait for JavaVM that isn't running"); + + return vm.waitFor(timeout, unit); + } + + /** * Starts the subprocess, waits for it to exit, and returns its exit status. */ public int execute() throws IOException, InterruptedException {