8081390: javax/management/remote/mandatory/connection/RMIConnector_NPETest.java may leave orphaned processes
authorxiaofeya
Tue, 06 Dec 2016 17:49:44 -0800
changeset 42437 3224b6452c24
parent 42436 83d5d07ae03a
child 42438 34eaac353f05
8081390: javax/management/remote/mandatory/connection/RMIConnector_NPETest.java may leave orphaned processes Reviewed-by: rriggs
jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java	Tue Dec 06 17:53:22 2016 -0800
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java	Tue Dec 06 17:49:44 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, 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
@@ -43,12 +43,12 @@
 public class RMIConnector_NPETest {
     public static void main(String argv[]) throws Exception {
         RMID rmid = RMID.createRMID();
-        rmid.start();
-        int rmidPort = rmid.getPort();
         Exception failureCause = null;
         RMIConnector agent = null;
 
         try {
+            rmid.start();
+            int rmidPort = rmid.getPort();
             MBeanServer mbs = MBeanServerFactory.createMBeanServer();
             RMIJRMPServerImpl rmiserver = new RMIJRMPServerImpl(rmidPort, null, null, null);
             rmiserver.setMBeanServer(mbs);
@@ -75,3 +75,4 @@
 
     }
 }
+