changeset 55534:f283f6871336

8203026: java.rmi.NoSuchObjectException: no such object in table Reviewed-by: rriggs, sspitsyn
author gadams
date Tue, 26 Mar 2019 07:09:10 -0400
parents 5487a925f70d
children 16999bd91ba6
files src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java src/jdk.jstatd/share/classes/sun/tools/jstatd/RemoteHostImpl.java
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java	Tue Mar 26 11:51:41 2019 +0100
+++ b/src/jdk.jstatd/share/classes/sun/tools/jstatd/Jstatd.java	Tue Mar 26 07:09:10 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -45,13 +45,14 @@
     private static Registry registry;
     private static int port = -1;
     private static boolean startRegistry = true;
+    private static RemoteHost remoteHost;
 
     private static void printUsage() {
         System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]\n" +
                            "       jstatd -?|-h|--help");
     }
 
-    static void bind(String name, RemoteHostImpl remoteHost)
+    static void bind(String name, RemoteHost remoteHost)
                 throws RemoteException, MalformedURLException, Exception {
 
         try {
@@ -138,10 +139,10 @@
         try {
             // use 1.5.0 dynamically generated subs.
             System.setProperty("java.rmi.server.ignoreSubClasses", "true");
-            RemoteHostImpl remoteHost = new RemoteHostImpl();
+            remoteHost = new RemoteHostImpl();
             RemoteHost stub = (RemoteHost) UnicastRemoteObject.exportObject(
                     remoteHost, 0);
-            bind(name.toString(), remoteHost);
+            bind(name.toString(), stub);
             System.out.println("jstatd started (bound to " + name.toString() + ")");
             System.out.flush();
         } catch (MalformedURLException e) {
--- a/src/jdk.jstatd/share/classes/sun/tools/jstatd/RemoteHostImpl.java	Tue Mar 26 11:51:41 2019 +0100
+++ b/src/jdk.jstatd/share/classes/sun/tools/jstatd/RemoteHostImpl.java	Tue Mar 26 07:09:10 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -50,6 +50,7 @@
 
     private MonitoredHost monitoredHost;
     private Set<Integer> activeVms;
+    private static RemoteVm rvm;
 
     public RemoteHostImpl() throws MonitorException {
         try {
@@ -76,7 +77,7 @@
         try {
             VmIdentifier vmid = new VmIdentifier(vmidStr);
             MonitoredVm mvm = monitoredHost.getMonitoredVm(vmid);
-            RemoteVmImpl rvm = new RemoteVmImpl((BufferedMonitoredVm)mvm);
+            rvm = new RemoteVmImpl((BufferedMonitoredVm)mvm);
             stub = (RemoteVm) UnicastRemoteObject.exportObject(rvm, 0);
         }
         catch (URISyntaxException e) {