# HG changeset patch
# User jbachorik
# Date 1447422245 -3600
# Node ID f30070a16a4b8c46e0242ffec6261fedcd77604b
# Parent 6beb09485bdd7af6e3210c52e6040f8d6ce037da
8043138: Attach API should not require jvmstat rmi protocol
Reviewed-by: alanb, mchung, erikj, ihse
diff -r 6beb09485bdd -r f30070a16a4b jdk/make/gensrc/Gensrc-jdk.jvmstat.gmk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gensrc/Gensrc-jdk.jvmstat.gmk Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+define merge-providers
+ $(MKDIR) -p $(@D)
+ $(CAT) $^ > $@
+endef
+
+PROVIDER_FILE := META-INF/services/sun.jvmstat.monitor.MonitoredHostService
+
+# Merge the local and remote sevice providers into jdk.jvmstat/META-INF/services
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jvmstat/$(PROVIDER_FILE): \
+ $(JDK_TOPDIR)/src/jdk.jvmstat/share/classes/$(PROVIDER_FILE) \
+ $(JDK_TOPDIR)/src/jdk.jvmstat.rmi/share/classes/$(PROVIDER_FILE)
+ $(merge-providers)
+
+# Copy the same service file into jdk.jvmstat.rmi so that they are kept the same.
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jvmstat.rmi/$(PROVIDER_FILE): \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jvmstat/$(PROVIDER_FILE)
+ $(install-file)
+
+################################################################################
+
+jdk.jvmstat: $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jvmstat/$(PROVIDER_FILE) \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jvmstat.rmi/$(PROVIDER_FILE)
+
+all: jdk.jvmstat
+
+.PHONY: all
\ No newline at end of file
diff -r 6beb09485bdd -r f30070a16a4b jdk/make/launcher/Launcher-jdk.jvmstat.gmk
--- a/jdk/make/launcher/Launcher-jdk.jvmstat.gmk Sun Nov 29 20:27:38 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 2011, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include LauncherCommon.gmk
-
-$(eval $(call SetupBuildLauncher, jstatd, \
- MAIN_CLASS := sun.tools.jstatd.Jstatd, \
-))
diff -r 6beb09485bdd -r f30070a16a4b jdk/make/launcher/Launcher-jdk.jvmstat.rmi.gmk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/launcher/Launcher-jdk.jvmstat.rmi.gmk Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2011, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LauncherCommon.gmk
+
+$(eval $(call SetupBuildLauncher, jstatd, \
+ MAIN_CLASS := sun.tools.jstatd.Jstatd, \
+))
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/META-INF/services/sun.jvmstat.monitor.MonitoredHostService
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jvmstat.rmi/share/classes/META-INF/services/sun.jvmstat.monitor.MonitoredHostService Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,1 @@
+sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteHost.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteHost.java Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.monitor.remote;
+
+import sun.jvmstat.monitor.*;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.io.IOException;
+
+/**
+ * Remote Interface for discovering and attaching to remote
+ * monitorable Java Virtual Machines.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public interface RemoteHost extends Remote {
+
+ /**
+ * Remote method to attach to a remote HotSpot Java Virtual Machine
+ * identified by vmid
.
+ *
+ * @param vmid The identifier for the target virtual machine.
+ * @return RemoteVm - A remote object for accessing the remote Java
+ * Virtual Machine.
+ *
+ * @throws MonitorException Thrown when any other error is encountered
+ * while communicating with the target virtual
+ * machine.
+ * @throws RemoteException
+ *
+ */
+ RemoteVm attachVm(int vmid, String mode) throws RemoteException,
+ MonitorException;
+
+ /**
+ * Remote method to detach from a remote HotSpot Java Virtual Machine
+ * identified by vmid
.
+ *
+ * @param rvm The remote object for the target Java Virtual
+ * Machine.
+ *
+ * @throws MonitorException Thrown when any other error is encountered
+ * while communicating with the target virtual
+ * machine.
+ * @throws RemoteException
+ */
+ void detachVm(RemoteVm rvm) throws RemoteException, MonitorException;
+
+ /**
+ * Get a list of Local Virtual Machine Identifiers for the active
+ * Java Virtual Machine the remote system. A Local Virtual Machine
+ * Identifier is also known as an lvmid.
+ *
+ * @return int[] - A array of lvmids.
+ * @throws MonitorException Thrown when any other error is encountered
+ * while communicating with the target virtual
+ * machine.
+ * @throws RemoteException
+ */
+ int[] activeVms() throws RemoteException, MonitorException;
+}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2004, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.jvmstat.monitor.remote;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Interface for accessing the instrumentation exported by a
+ * Java Virtual Machine running on a remote host.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public interface RemoteVm extends Remote {
+
+ /**
+ * Interface to get the bytes associated with the instrumentation
+ * for the remote Java Virtual Machine.
+ *
+ * @return byte[] - a byte array containing the current bytes
+ * for the instrumentation exported by the
+ * remote Java Virtual Machine.
+ * @throws RemoteException Thrown on any communication error
+ */
+ byte[] getBytes() throws RemoteException;
+
+ /**
+ * Interface to get the size of the instrumentation buffer
+ * for the target Java Virtual Machine.
+ *
+ * @return int - the size of the instrumentation buffer for the
+ * remote Java Virtual Machine.
+ * @throws RemoteException Thrown on any communication error
+ */
+ int getCapacity() throws RemoteException;
+
+ /**
+ * Interface to return the Local Virtual Machine Identifier for
+ * the remote Java Virtual Machine. The Local Virtual Machine
+ * Identifier is also know as the lvmid.
+ *
+ * @throws RemoteException Thrown on any communication error
+ */
+ int getLocalVmId() throws RemoteException;
+
+ /**
+ * Interface to detach from the remote Java Virtual Machine.
+ *
+ * @throws RemoteException Thrown on any communication error
+ */
+ void detach() throws RemoteException;
+}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/package.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/monitor/remote/package.html Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,39 @@
+
+
+
+Provides interfaces supporting remote monitoring for instrumented +HotSpot Java Virtual Machines. +
+ + diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java Fri Nov 13 14:44:05 2015 +0100 @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2004, 2014, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.jvmstat.perfdata.monitor.protocol.rmi; + +import sun.jvmstat.monitor.*; +import sun.jvmstat.monitor.event.*; +import sun.jvmstat.monitor.remote.*; +import sun.jvmstat.perfdata.monitor.*; +import java.util.*; +import java.net.*; +import java.io.*; +import java.rmi.*; +import java.util.HashMap; + +/** + * Concrete implementation of the MonitoredHost interface for the + * rmi protocol of the HotSpot PerfData monitoring implementation. + * + * @author Brian Doherty + * @since 1.5 + */ +public class MonitoredHostProvider extends MonitoredHost { + private static final String serverName = "/JStatRemoteHost"; + private static final int DEFAULT_POLLING_INTERVAL = 1000; + + private ArrayList+ * This class is responsible for acquiring the instrumentation buffer + * data for a remote target HotSpot Java Virtual Machine. + * + * @author Brian Doherty + * @since 1.5 + */ +public class PerfDataBuffer extends AbstractPerfDataBuffer { + + private RemoteVm rvm; + + /** + * Create a PerfDataBuffer instance for accessing the specified + * instrumentation buffer. + * + * @param rvm the proxy to the remote MonitredVm object + * @param lvmid the local Java Virtual Machine Identifier of the + * remote target. + * + * @throws MonitorException + */ + public PerfDataBuffer(RemoteVm rvm, int lvmid) throws MonitorException { + + this.rvm = rvm; + try { + ByteBuffer buffer = ByteBuffer.allocate(rvm.getCapacity()); + sample(buffer); + createPerfDataBuffer(buffer, lvmid); + + } catch (RemoteException e) { + throw new MonitorException("Could not read data for remote JVM " + + lvmid, e); + } + } + + /** + * Get a copy of the remote instrumentation buffer. + *
+ * The data in the remote instrumentation buffer is copied into + * the local byte buffer. + * + * @param buffer the buffer to receive the copy of the remote + * instrumentation buffer. + * @throws RemoteException Thrown on any communications errors with + * the remote system. + */ + public void sample(ByteBuffer buffer) throws RemoteException { + assert buffer != null; + assert rvm != null; + synchronized(buffer) { + buffer.clear(); + buffer.put(rvm.getBytes()); + } + } +} diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java Fri Nov 13 14:44:05 2015 +0100 @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2004, 2014, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.jvmstat.perfdata.monitor.protocol.rmi; + +import sun.jvmstat.monitor.*; +import sun.jvmstat.monitor.event.*; +import sun.jvmstat.monitor.remote.*; +import sun.jvmstat.perfdata.monitor.*; +import java.lang.reflect.*; +import java.util.*; +import java.io.*; +import java.nio.ByteBuffer; +import java.rmi.*; + +/** + * Concrete implementation of the AbstractMonitoredVm class for the + * rmi: protocol for the HotSpot PerfData monitoring implementation. + *
+ * This class provides the ability to acquire to the instrumentation buffer
+ * of a live, remote target Java Virtual Machine through an RMI server.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteMonitoredVm extends AbstractMonitoredVm {
+
+ private ArrayList
+ * The data in the remote instrumentation buffer is copied into
+ * a local byte buffer.
+ *
+ * @throws RemoteException Thrown on any communications errors with
+ * the remote system.
+ */
+ public void sample() throws RemoteException {
+ assert updateBuffer != null;
+ ((PerfDataBuffer)pdb).sample(updateBuffer);
+ }
+
+ /**
+ * Get the proxy to the remote MonitoredVm.
+ *
+ * @return RemoteVm - the proxy to the remote MonitoredVm.
+ */
+ public RemoteVm getRemoteVm() {
+ return rvm;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addVmListener(VmListener l) {
+ synchronized(listeners) {
+ listeners.add(l);
+ if (notifierTask == null) {
+ notifierTask = new NotifierTask();
+ timer.schedule(notifierTask, 0, interval);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeVmListener(VmListener l) {
+ synchronized(listeners) {
+ listeners.remove(l);
+ if (listeners.isEmpty() && (notifierTask != null)) {
+ notifierTask.cancel();
+ notifierTask = null;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setInterval(int newInterval) {
+ synchronized(listeners) {
+ if (newInterval == interval) {
+ return;
+ }
+
+ int oldInterval = interval;
+ super.setInterval(newInterval);
+
+ if (samplerTask != null) {
+ samplerTask.cancel();
+ SamplerTask oldSamplerTask = samplerTask;
+ samplerTask = new SamplerTask();
+ CountedTimerTaskUtils.reschedule(timer, oldSamplerTask,
+ samplerTask, oldInterval,
+ newInterval);
+ }
+ if (notifierTask != null) {
+ notifierTask.cancel();
+ NotifierTask oldNotifierTask = notifierTask;
+ notifierTask = new NotifierTask();
+ CountedTimerTaskUtils.reschedule(timer, oldNotifierTask,
+ notifierTask, oldInterval,
+ newInterval);
+ }
+ }
+ }
+
+ /**
+ * Fire MonitoredVmStructureChanged events.
+ *
+ * @param inserted List of Monitor objects inserted.
+ * @param removed List of Monitor objects removed.
+ */
+ @SuppressWarnings("unchecked") // Cast of result of clone
+ void fireMonitorStatusChangedEvents(List
+ * This class is responsible for the mechanism that detects the active
+ * HotSpot Java Virtual Machines on the remote host and possibly for a
+ * specific user. The ability to detect all possible HotSpot Java Virtual
+ * Machines on the remote host may be limited by the permissions of the
+ * principal running the RMI server application on the remote host.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteVmManager {
+
+ private RemoteHost remoteHost;
+ private String user;
+
+ /**
+ * Creates a RemoteVmManager instance for the remote system.
+ *
+ * Manages RemoteMonitordVm instances for which the principal
+ * running the remote server has appropriate permissions.
+ *
+ * @param remoteHost the remote proxy object to the RMI server on
+ * the remote system.
+ */
+ public RemoteVmManager(RemoteHost remoteHost) {
+ this(remoteHost, null);
+ }
+
+ /**
+ * Creates a RemoteVmManager instance for the given user.
+ *
+ * Manages RemoteMonitoredVm instances for all remote Java Virtual
+ * machines owned by the specified user on the remote system. The
+ * RMI server on the remote system must have the appropriate permissions
+ * to access the named users Java Virtual Machines.
+ *
+ * @param remoteHost the remote proxy object to the RMI server on
+ * the remote system.
+ * @param user the name of the user
+ */
+ public RemoteVmManager(RemoteHost remoteHost, String user) {
+ this.user = user;
+ this.remoteHost = remoteHost;
+ }
+
+ /**
+ * Return the current set of monitorable Java Virtual Machines.
+ *
+ * The set returned by this method depends on the user name passed
+ * to the constructor. If no user name was specified, then this
+ * method will return all candidate JVMs on the system. Otherwise,
+ * only the JVMs for the given user will be returned. This assumes
+ * that the RMI server process has the appropriate permissions to
+ * access the target set of JVMs.
+ *
+ * @return Set - the Set of monitorable Java Virtual Machines
+ */
+ public Set
+Provides the implementation classes for the rmi: protocol for
+the HotSpot PerfData instrumentation buffer monitoring implementation.
+
+The rmi: protocol is the default protocol for the PerfData
+implementation when a hostname is specified as part of a HostIdentifier
+or VMIdentifier. It communicates with an RMI server on the remote machine
+that provides functions to get a list of available Java Virtual Machines
+and to acquire a copy of a Java Virtual Machine's instrumentation buffer.
+The RMI server may or may not use the PerfData implementation on the
+remote host to acquire this information. The jstatd server
+provides a PerfData implementation of the RMI server.
+
+
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/Jstatd.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/Jstatd.java Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,164 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.jstatd;
+
+import java.rmi.*;
+import java.rmi.server.*;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+import java.net.MalformedURLException;
+import sun.jvmstat.monitor.remote.*;
+
+/**
+ * Application providing remote access to the jvmstat instrumentation
+ * exported by local Java Virtual Machine processes. Remote access is
+ * provided through an RMI interface.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class Jstatd {
+
+ private static Registry registry;
+ private static int port = -1;
+ private static boolean startRegistry = true;
+
+ private static void printUsage() {
+ System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]");
+ }
+
+ static void bind(String name, RemoteHostImpl remoteHost)
+ throws RemoteException, MalformedURLException, Exception {
+
+ try {
+ Naming.rebind(name, remoteHost);
+ } catch (java.rmi.ConnectException e) {
+ /*
+ * either the registry is not running or we cannot contact it.
+ * start an internal registry if requested.
+ */
+ if (startRegistry && registry == null) {
+ int localport = (port < 0) ? Registry.REGISTRY_PORT : port;
+ registry = LocateRegistry.createRegistry(localport);
+ bind(name, remoteHost);
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation") // Use of RMISecurityManager
+ public static void main(String[] args) {
+ String rminame = null;
+ int argc = 0;
+
+ for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
+ String arg = args[argc];
+
+ if (arg.compareTo("-nr") == 0) {
+ startRegistry = false;
+ } else if (arg.startsWith("-p")) {
+ if (arg.compareTo("-p") != 0) {
+ port = Integer.parseInt(arg.substring(2));
+ } else {
+ argc++;
+ if (argc >= args.length) {
+ printUsage();
+ System.exit(1);
+ }
+ port = Integer.parseInt(args[argc]);
+ }
+ } else if (arg.startsWith("-n")) {
+ if (arg.compareTo("-n") != 0) {
+ rminame = arg.substring(2);
+ } else {
+ argc++;
+ if (argc >= args.length) {
+ printUsage();
+ System.exit(1);
+ }
+ rminame = args[argc];
+ }
+ } else {
+ printUsage();
+ System.exit(1);
+ }
+ }
+
+ if (argc < args.length) {
+ printUsage();
+ System.exit(1);
+ }
+
+ if (System.getSecurityManager() == null) {
+ System.setSecurityManager(new RMISecurityManager());
+ }
+
+ StringBuilder name = new StringBuilder();
+
+ if (port >= 0) {
+ name.append("//:").append(port);
+ }
+
+ if (rminame == null) {
+ rminame = "JStatRemoteHost";
+ }
+
+ name.append("/").append(rminame);
+
+ try {
+ // use 1.5.0 dynamically generated subs.
+ System.setProperty("java.rmi.server.ignoreSubClasses", "true");
+ RemoteHostImpl remoteHost = new RemoteHostImpl();
+ 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);
+ } else {
+ System.out.println("Bad RMI URL: " + name);
+ }
+ e.printStackTrace(System.out);
+ System.exit(1);
+ } catch (java.rmi.ConnectException e) {
+ // could not attach to or create a registry
+ System.out.println("Could not contact RMI registry");
+ e.printStackTrace(System.out);
+ System.exit(1);
+ } catch (RemoteException e) {
+ System.out.println("Could not bind " + name + " to RMI Registry");
+ e.printStackTrace(System.out);
+ System.exit(1);
+ } catch (Exception e) {
+ System.out.println("Could not create remote object");
+ e.printStackTrace(System.out);
+ System.exit(1);
+ }
+ }
+}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/RemoteHostImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jvmstat.rmi/share/classes/sun/tools/jstatd/RemoteHostImpl.java Fri Nov 13 14:44:05 2015 +0100
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2004, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.jstatd;
+
+import java.util.*;
+import java.nio.*;
+import java.io.*;
+import java.net.*;
+import java.rmi.*;
+import java.rmi.server.*;
+import sun.jvmstat.monitor.*;
+import sun.jvmstat.monitor.event.*;
+import sun.jvmstat.monitor.remote.*;
+
+/**
+ * Concrete implementation of the RemoteHost interface for the HotSpot
+ * PerfData rmi: protocol.
+ *
+ * This class provides remote access to the instrumentation exported
+ * by HotSpot Java Virtual Machines through the PerfData shared memory
+ * interface.
+ *
+ * @author Brian Doherty
+ * @since 1.5
+ */
+public class RemoteHostImpl implements RemoteHost, HostListener {
+
+ private MonitoredHost monitoredHost;
+ private Set
-Provides interfaces supporting remote monitoring for instrumented
-HotSpot Java Virtual Machines.
-
- * This class is responsible for acquiring the instrumentation buffer
- * data for a remote target HotSpot Java Virtual Machine.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class PerfDataBuffer extends AbstractPerfDataBuffer {
-
- private RemoteVm rvm;
-
- /**
- * Create a PerfDataBuffer instance for accessing the specified
- * instrumentation buffer.
- *
- * @param rvm the proxy to the remote MonitredVm object
- * @param lvmid the local Java Virtual Machine Identifier of the
- * remote target.
- *
- * @throws MonitorException
- */
- public PerfDataBuffer(RemoteVm rvm, int lvmid) throws MonitorException {
-
- this.rvm = rvm;
- try {
- ByteBuffer buffer = ByteBuffer.allocate(rvm.getCapacity());
- sample(buffer);
- createPerfDataBuffer(buffer, lvmid);
-
- } catch (RemoteException e) {
- throw new MonitorException("Could not read data for remote JVM "
- + lvmid, e);
- }
- }
-
- /**
- * Get a copy of the remote instrumentation buffer.
- *
- * The data in the remote instrumentation buffer is copied into
- * the local byte buffer.
- *
- * @param buffer the buffer to receive the copy of the remote
- * instrumentation buffer.
- * @throws RemoteException Thrown on any communications errors with
- * the remote system.
- */
- public void sample(ByteBuffer buffer) throws RemoteException {
- assert buffer != null;
- assert rvm != null;
- synchronized(buffer) {
- buffer.clear();
- buffer.put(rvm.getBytes());
- }
- }
-}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java Sun Nov 29 20:27:38 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 2004, 2014, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.jvmstat.perfdata.monitor.protocol.rmi;
-
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
-import sun.jvmstat.monitor.remote.*;
-import sun.jvmstat.perfdata.monitor.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.io.*;
-import java.nio.ByteBuffer;
-import java.rmi.*;
-
-/**
- * Concrete implementation of the AbstractMonitoredVm class for the
- * rmi: protocol for the HotSpot PerfData monitoring implementation.
- *
- * This class provides the ability to acquire to the instrumentation buffer
- * of a live, remote target Java Virtual Machine through an RMI server.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteMonitoredVm extends AbstractMonitoredVm {
-
- private ArrayList
- * The data in the remote instrumentation buffer is copied into
- * a local byte buffer.
- *
- * @throws RemoteException Thrown on any communications errors with
- * the remote system.
- */
- public void sample() throws RemoteException {
- assert updateBuffer != null;
- ((PerfDataBuffer)pdb).sample(updateBuffer);
- }
-
- /**
- * Get the proxy to the remote MonitoredVm.
- *
- * @return RemoteVm - the proxy to the remote MonitoredVm.
- */
- public RemoteVm getRemoteVm() {
- return rvm;
- }
-
- /**
- * {@inheritDoc}
- */
- public void addVmListener(VmListener l) {
- synchronized(listeners) {
- listeners.add(l);
- if (notifierTask == null) {
- notifierTask = new NotifierTask();
- timer.schedule(notifierTask, 0, interval);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeVmListener(VmListener l) {
- synchronized(listeners) {
- listeners.remove(l);
- if (listeners.isEmpty() && (notifierTask != null)) {
- notifierTask.cancel();
- notifierTask = null;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void setInterval(int newInterval) {
- synchronized(listeners) {
- if (newInterval == interval) {
- return;
- }
-
- int oldInterval = interval;
- super.setInterval(newInterval);
-
- if (samplerTask != null) {
- samplerTask.cancel();
- SamplerTask oldSamplerTask = samplerTask;
- samplerTask = new SamplerTask();
- CountedTimerTaskUtils.reschedule(timer, oldSamplerTask,
- samplerTask, oldInterval,
- newInterval);
- }
- if (notifierTask != null) {
- notifierTask.cancel();
- NotifierTask oldNotifierTask = notifierTask;
- notifierTask = new NotifierTask();
- CountedTimerTaskUtils.reschedule(timer, oldNotifierTask,
- notifierTask, oldInterval,
- newInterval);
- }
- }
- }
-
- /**
- * Fire MonitoredVmStructureChanged events.
- *
- * @param inserted List of Monitor objects inserted.
- * @param removed List of Monitor objects removed.
- */
- @SuppressWarnings("unchecked") // Cast of result of clone
- void fireMonitorStatusChangedEvents(List
- * This class is responsible for the mechanism that detects the active
- * HotSpot Java Virtual Machines on the remote host and possibly for a
- * specific user. The ability to detect all possible HotSpot Java Virtual
- * Machines on the remote host may be limited by the permissions of the
- * principal running the RMI server application on the remote host.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteVmManager {
-
- private RemoteHost remoteHost;
- private String user;
-
- /**
- * Creates a RemoteVmManager instance for the remote system.
- *
- * Manages RemoteMonitordVm instances for which the principal
- * running the remote server has appropriate permissions.
- *
- * @param remoteHost the remote proxy object to the RMI server on
- * the remote system.
- */
- public RemoteVmManager(RemoteHost remoteHost) {
- this(remoteHost, null);
- }
-
- /**
- * Creates a RemoteVmManager instance for the given user.
- *
- * Manages RemoteMonitoredVm instances for all remote Java Virtual
- * machines owned by the specified user on the remote system. The
- * RMI server on the remote system must have the appropriate permissions
- * to access the named users Java Virtual Machines.
- *
- * @param remoteHost the remote proxy object to the RMI server on
- * the remote system.
- * @param user the name of the user
- */
- public RemoteVmManager(RemoteHost remoteHost, String user) {
- this.user = user;
- this.remoteHost = remoteHost;
- }
-
- /**
- * Return the current set of monitorable Java Virtual Machines.
- *
- * The set returned by this method depends on the user name passed
- * to the constructor. If no user name was specified, then this
- * method will return all candidate JVMs on the system. Otherwise,
- * only the JVMs for the given user will be returned. This assumes
- * that the RMI server process has the appropriate permissions to
- * access the target set of JVMs.
- *
- * @return Set - the Set of monitorable Java Virtual Machines
- */
- public Set
-Provides the implementation classes for the rmi: protocol for
-the HotSpot PerfData instrumentation buffer monitoring implementation.
-
-The rmi: protocol is the default protocol for the PerfData
-implementation when a hostname is specified as part of a HostIdentifier
-or VMIdentifier. It communicates with an RMI server on the remote machine
-that provides functions to get a list of available Java Virtual Machines
-and to acquire a copy of a Java Virtual Machine's instrumentation buffer.
-The RMI server may or may not use the PerfData implementation on the
-remote host to acquire this information. The jstatd server
-provides a PerfData implementation of the RMI server.
-
-
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java
--- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java Sun Nov 29 20:27:38 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools.jstatd;
-
-import java.rmi.*;
-import java.rmi.server.*;
-import java.rmi.registry.Registry;
-import java.rmi.registry.LocateRegistry;
-import java.net.MalformedURLException;
-import sun.jvmstat.monitor.remote.*;
-
-/**
- * Application providing remote access to the jvmstat instrumentation
- * exported by local Java Virtual Machine processes. Remote access is
- * provided through an RMI interface.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class Jstatd {
-
- private static Registry registry;
- private static int port = -1;
- private static boolean startRegistry = true;
-
- private static void printUsage() {
- System.err.println("usage: jstatd [-nr] [-p port] [-n rminame]");
- }
-
- static void bind(String name, RemoteHostImpl remoteHost)
- throws RemoteException, MalformedURLException, Exception {
-
- try {
- Naming.rebind(name, remoteHost);
- } catch (java.rmi.ConnectException e) {
- /*
- * either the registry is not running or we cannot contact it.
- * start an internal registry if requested.
- */
- if (startRegistry && registry == null) {
- int localport = (port < 0) ? Registry.REGISTRY_PORT : port;
- registry = LocateRegistry.createRegistry(localport);
- bind(name, remoteHost);
- } else {
- throw e;
- }
- }
- }
-
- @SuppressWarnings("deprecation") // Use of RMISecurityManager
- public static void main(String[] args) {
- String rminame = null;
- int argc = 0;
-
- for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
- String arg = args[argc];
-
- if (arg.compareTo("-nr") == 0) {
- startRegistry = false;
- } else if (arg.startsWith("-p")) {
- if (arg.compareTo("-p") != 0) {
- port = Integer.parseInt(arg.substring(2));
- } else {
- argc++;
- if (argc >= args.length) {
- printUsage();
- System.exit(1);
- }
- port = Integer.parseInt(args[argc]);
- }
- } else if (arg.startsWith("-n")) {
- if (arg.compareTo("-n") != 0) {
- rminame = arg.substring(2);
- } else {
- argc++;
- if (argc >= args.length) {
- printUsage();
- System.exit(1);
- }
- rminame = args[argc];
- }
- } else {
- printUsage();
- System.exit(1);
- }
- }
-
- if (argc < args.length) {
- printUsage();
- System.exit(1);
- }
-
- if (System.getSecurityManager() == null) {
- System.setSecurityManager(new RMISecurityManager());
- }
-
- StringBuilder name = new StringBuilder();
-
- if (port >= 0) {
- name.append("//:").append(port);
- }
-
- if (rminame == null) {
- rminame = "JStatRemoteHost";
- }
-
- name.append("/").append(rminame);
-
- try {
- // use 1.5.0 dynamically generated subs.
- System.setProperty("java.rmi.server.ignoreSubClasses", "true");
- RemoteHostImpl remoteHost = new RemoteHostImpl();
- 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);
- } else {
- System.out.println("Bad RMI URL: " + name);
- }
- e.printStackTrace(System.out);
- System.exit(1);
- } catch (java.rmi.ConnectException e) {
- // could not attach to or create a registry
- System.out.println("Could not contact RMI registry");
- e.printStackTrace(System.out);
- System.exit(1);
- } catch (RemoteException e) {
- System.out.println("Could not bind " + name + " to RMI Registry");
- e.printStackTrace(System.out);
- System.exit(1);
- } catch (Exception e) {
- System.out.println("Could not create remote object");
- e.printStackTrace(System.out);
- System.exit(1);
- }
- }
-}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java
--- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java Sun Nov 29 20:27:38 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2004, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.tools.jstatd;
-
-import java.util.*;
-import java.nio.*;
-import java.io.*;
-import java.net.*;
-import java.rmi.*;
-import java.rmi.server.*;
-import sun.jvmstat.monitor.*;
-import sun.jvmstat.monitor.event.*;
-import sun.jvmstat.monitor.remote.*;
-
-/**
- * Concrete implementation of the RemoteHost interface for the HotSpot
- * PerfData rmi: protocol.
- *
- * This class provides remote access to the instrumentation exported
- * by HotSpot Java Virtual Machines through the PerfData shared memory
- * interface.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public class RemoteHostImpl implements RemoteHost, HostListener {
-
- private MonitoredHost monitoredHost;
- private Setvmid
.
- *
- * @param vmid The identifier for the target virtual machine.
- * @return RemoteVm - A remote object for accessing the remote Java
- * Virtual Machine.
- *
- * @throws MonitorException Thrown when any other error is encountered
- * while communicating with the target virtual
- * machine.
- * @throws RemoteException
- *
- */
- RemoteVm attachVm(int vmid, String mode) throws RemoteException,
- MonitorException;
-
- /**
- * Remote method to detach from a remote HotSpot Java Virtual Machine
- * identified by vmid
.
- *
- * @param rvm The remote object for the target Java Virtual
- * Machine.
- *
- * @throws MonitorException Thrown when any other error is encountered
- * while communicating with the target virtual
- * machine.
- * @throws RemoteException
- */
- void detachVm(RemoteVm rvm) throws RemoteException, MonitorException;
-
- /**
- * Get a list of Local Virtual Machine Identifiers for the active
- * Java Virtual Machine the remote system. A Local Virtual Machine
- * Identifier is also known as an lvmid.
- *
- * @return int[] - A array of lvmids.
- * @throws MonitorException Thrown when any other error is encountered
- * while communicating with the target virtual
- * machine.
- * @throws RemoteException
- */
- int[] activeVms() throws RemoteException, MonitorException;
-}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/remote/RemoteVm.java Sun Nov 29 20:27:38 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2004, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.jvmstat.monitor.remote;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/**
- * Interface for accessing the instrumentation exported by a
- * Java Virtual Machine running on a remote host.
- *
- * @author Brian Doherty
- * @since 1.5
- */
-public interface RemoteVm extends Remote {
-
- /**
- * Interface to get the bytes associated with the instrumentation
- * for the remote Java Virtual Machine.
- *
- * @return byte[] - a byte array containing the current bytes
- * for the instrumentation exported by the
- * remote Java Virtual Machine.
- * @throws RemoteException Thrown on any communication error
- */
- byte[] getBytes() throws RemoteException;
-
- /**
- * Interface to get the size of the instrumentation buffer
- * for the target Java Virtual Machine.
- *
- * @return int - the size of the instrumentation buffer for the
- * remote Java Virtual Machine.
- * @throws RemoteException Thrown on any communication error
- */
- int getCapacity() throws RemoteException;
-
- /**
- * Interface to return the Local Virtual Machine Identifier for
- * the remote Java Virtual Machine. The Local Virtual Machine
- * Identifier is also know as the lvmid.
- *
- * @throws RemoteException Thrown on any communication error
- */
- int getLocalVmId() throws RemoteException;
-
- /**
- * Interface to detach from the remote Java Virtual Machine.
- *
- * @throws RemoteException Thrown on any communication error
- */
- void detach() throws RemoteException;
-}
diff -r 6beb09485bdd -r f30070a16a4b jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/remote/package.html
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/monitor/remote/package.html Sun Nov 29 20:27:38 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-