8027668: sun/tools/jstatd/TestJstatdPort.java: java.net.ConnectException: Connection refused: connect

Reviewed-by: jbachorik, sla
This commit is contained in:
Katja Kantserova 2015-04-07 14:47:33 +02:00
parent 99f902972c
commit 0ef006faca
3 changed files with 10 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2015, 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
@ -142,6 +142,8 @@ public class Jstatd {
RemoteHost stub = (RemoteHost) UnicastRemoteObject.exportObject(
remoteHost, 0);
bind(name.toString(), remoteHost);
System.out.println("jstatd started (bound to " + name.toString() + ")");
System.out.flush();
} catch (MalformedURLException e) {
if (rminame != null) {
System.out.println("Bad RMI server name: " + rminame);

View File

@ -318,13 +318,7 @@ sun/tools/jcmd/TestJcmdSanity.java windows-all
# 8072131
sun/tools/jmap/heapconfig/JMapHeapConfigTest.java macosx-all
# 8027668
sun/tools/jstatd/TestJstatdDefaults.java generic-all
sun/tools/jstatd/TestJstatdServer.java generic-all
sun/tools/jstatd/TestJstatdPort.java generic-all
sun/tools/jstatd/TestJstatdPortAndServer.java generic-all
# 8046285 8027668
# 8046285
sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all
# 6456333

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, 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
@ -22,7 +22,6 @@
*/
import java.io.File;
import java.io.IOException;
import java.net.UnknownHostException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
@ -130,8 +129,6 @@ public final class JstatdTest {
private OutputAnalyzer runJps() throws Exception {
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
launcher.addVMArg("-XX:+UsePerfData");
// Run jps with -v flag to obtain -Dparent.pid.<pid>
launcher.addToolArg("-v");
launcher.addToolArg(getDestination());
String[] cmd = launcher.getCommand();
@ -277,8 +274,6 @@ public final class JstatdTest {
assertTrue(policy.exists() && policy.isFile(),
"Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
// -Dparent.pid.<pid> will help to identify jstad process started by this test
launcher.addVMArg("-Dparent.pid." + ProcessTools.getProcessId());
if (port != null) {
launcher.addToolArg("-p");
launcher.addToolArg(port);
@ -295,7 +290,7 @@ public final class JstatdTest {
private ProcessThread tryToSetupJstatdProcess() throws Throwable {
ProcessThread jstatdThread = new ProcessThread("Jstatd-Thread",
getJstatdCmd());
JstatdTest::isJstadReady, getJstatdCmd());
try {
jstatdThread.start();
// Make sure jstatd is up and running
@ -315,6 +310,10 @@ public final class JstatdTest {
return jstatdThread;
}
private static boolean isJstadReady(String line) {
return line.startsWith("jstatd started (bound to ");
}
public void doTest() throws Throwable {
ProcessThread jstatdThread = null;
try {