/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
// Sun specific
// Sun private
public class LocalVirtualMachine {
private int vmid;
private boolean isAttachSupported;
public LocalVirtualMachine(int vmid, String commandLine, boolean canAttach, String connectorAddress) {
this.commandLine = commandLine;
this.address = connectorAddress;
this.isAttachSupported = canAttach;
}
// trim the pathname of jar file if it's a jar
}
return displayName;
}
return commandLine;
}
public int vmid() {
return vmid;
}
public boolean isManageable() {
}
public boolean isAttachable() {
return isAttachSupported;
}
// already started
return;
}
if (!isAttachable()) {
"\" does not support dynamic attach.");
}
// fails to load or start the management agent
// should never reach here
throw new IOException("Fails to find connector address");
}
}
// return null if not available or no JMX agent
return address;
}
return displayName;
}
return commandLine;
}
// This method returns the list of all virtual machines currently
// running on the machine
return map;
}
try {
} catch (MonitorException mx) {
}
boolean attachable = false;
try {
// use the command line as the display name
} catch (Exception x) {
// ignore
}
}
}
}
"com.sun.management.jmxremote.localConnectorAddress";
try {
boolean attachable = false;
try {
attachable = true;
} catch (AttachNotSupportedException x) {
// not attachable
} catch (IOException x) {
// ignore
}
vmd.displayName(),
address));
}
} catch (NumberFormatException e) {
// do not support vmid different than pid
}
}
}
// Check if the VM is attachable but not included in the list
// if it's running with a different security context.
// For example, Windows services running
// local SYSTEM account are attachable if you have Adminstrator
// privileges.
boolean attachable = false;
try {
attachable = true;
} catch (AttachNotSupportedException x) {
// not attachable
x.printStackTrace();
}
} catch (IOException x) {
// ignore
x.printStackTrace();
}
}
}
return lvm;
}
// load the management agent into the target VM
try {
} catch (AttachNotSupportedException x) {
throw ioe;
}
// Normally in ${java.home}/jre/lib/management-agent.jar but might
// be in ${java.home}/lib in build environments.
if (!f.exists()) {
"management-agent.jar";
if (!f.exists()) {
throw new IOException("Management agent not found");
}
}
agent = f.getCanonicalPath();
try {
} catch (AgentLoadException x) {
throw ioe;
} catch (AgentInitializationException x) {
throw ioe;
}
// get the connector address
}
}