Mercurial > hg > jdk9-shenandoah
changeset 1558:12797cd2edfa
8081576: serviceability/sa tests fail due to LingeredApp process fails to start
Summary: Provide a API to corrctly terminate LingeredApp
Reviewed-by: sspitsyn
author | dsamersoff |
---|---|
date | Tue, 23 Jun 2015 12:30:57 +0300 |
parents | 178f65f48dc1 |
children | 9b4849be2220 |
files | test/lib/share/classes/jdk/test/lib/apps/LingeredApp.java |
diffstat | 1 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/test/lib/share/classes/jdk/test/lib/apps/LingeredApp.java Wed Jun 17 21:43:26 2015 +0000 +++ b/test/lib/share/classes/jdk/test/lib/apps/LingeredApp.java Tue Jun 23 12:30:57 2015 +0300 @@ -287,7 +287,7 @@ } } else{ - // Lets user manage LingerApp options + // Lets user manage LingeredApp options cmd.addAll(vmArguments); } @@ -321,6 +321,20 @@ } /** + * Delete lock file that signals app to terminate, then + * wait until app is actually terminated. + * @throws IOException + */ + public void stopApp() throws IOException { + deleteLock(); + waitAppTerminate(); + int exitcode = appProcess.exitValue(); + if (exitcode != 0) { + throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode); + } + } + + /** * High level interface for test writers */ /** @@ -351,17 +365,11 @@ return startApp(null); } - /** - * Delete lock file that signal app to terminate, then - * waits until app is actually terminated. - * @throws IOException - */ - public void stopApp() throws IOException { - deleteLock(); - waitAppTerminate(); - int exitcode = appProcess.exitValue(); - if (exitcode != 0) { - throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode); + public static void stopApp(LingeredApp app) throws IOException { + if (app != null) { + // LingeredApp can throw an exception during the intialization, + // make sure we don't have cascade NPE + app.stopApp(); } }