[8u] RFR 8263601: TEST_BUG: remove ActivationLibrary.DestroyThread and have callers call rmid.destroy() instead
Zhengyu Gu
zgu at redhat.com
Wed Apr 28 13:26:26 UTC 2021
Hi,
Make sense, especially, 8032050 backport is clean.
Thanks for the suggestion.
-Zhengyu
On 4/27/21 4:26 PM, Hohensee, Paul wrote:
> Why not backport 8032050 first? It isn't very big, in fact most of it is waitFor().
>
> Thanks,
> Paul
>
> -----Original Message-----
> From: jdk8u-dev <jdk8u-dev-retn at openjdk.java.net> on behalf of Zhengyu Gu <zgu at redhat.com>
> Date: Monday, March 15, 2021 at 10:21 AM
> To: jdk8u-dev <jdk8u-dev at openjdk.java.net>
> Subject: [8u] RFR 8263601: TEST_BUG: remove ActivationLibrary.DestroyThread and have callers call rmid.destroy() instead
>
> Hi,
>
> I would like to backport this patch to 8u for parity with Oracle 8u301.
>
> Original bug: https://bugs.openjdk.java.net/browse/JDK-8035000
> Original patch: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/1b599b4755bd
>
> The original patch applies cleanly.
>
> However, patched RMID.java uses waitFor(long timeout) method, that was
> introduced by JDK-8032050 [1] and it is not backported to 8u. Therefore,
> I propose backport this specific function from JDK-8032050 with this patch.
>
>
> --- old/test/java/rmi/testlibrary/JavaVM.java 2021-03-15
> 13:03:32.298020591 -0400
> +++ new/test/java/rmi/testlibrary/JavaVM.java 2021-03-15
> 13:03:32.157020372 -0400
> @@ -26,6 +26,7 @@
> import java.io.OutputStream;
> import java.util.Arrays;
> import java.util.StringTokenizer;
> +import java.util.concurrent.TimeoutException;
>
> /**
> * RMI regression test utility class that uses Runtime.exec to spawn a
> @@ -183,6 +184,39 @@
> errPipe.join();
> return status;
> }
> + /**
> + * Causes the current thread to wait the vm process to exit, if
> necessary,
> + * wait until the vm process has terminated, or the specified
> waiting time
> + * elapses. Release allocated input/output after vm process has
> terminated.
> + * @param timeout the maximum milliseconds to wait.
> + * @return exit value for vm process.
> + * @throws InterruptedException if the current thread is interrupted
> + * while waiting.
> + * @throws TimeoutException if subprocess does not end after timeout
> + * milliseconds passed
> + */
> + public int waitFor(long timeout)
> + throws InterruptedException, TimeoutException {
> + if (vm == null)
> + throw new IllegalStateException("can't wait for JavaVM
> that isn't running");
> + long startTime = System.currentTimeMillis();
> + long rem = timeout;
> +
> + do {
> + try {
> + int status = vm.exitValue();
> + outPipe.join();
> + errPipe.join();
> + return status;
> + } catch (IllegalThreadStateException ex) {
> + if (rem > 0) {
> + Thread.sleep(Math.min(rem, 100));
> + }
> + }
> + rem = timeout - (System.currentTimeMillis() - startTime);
> + } while (rem > 0);
> + throw new TimeoutException();
> + }
>
> /**
> * Starts the subprocess, waits for it to exit, and returns its
> exit status.
>
>
> Thanks,
>
> -Zhengyu
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8032050
>
>
More information about the jdk8u-dev
mailing list