com.sun.tools.attach.VirtualMachineDescriptor Java Examples

The following examples show how to use com.sun.tools.attach.VirtualMachineDescriptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BsdAttachProvider.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new BsdVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #2
Source File: LinuxAttachProvider.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #3
Source File: LinuxAttachProvider.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #4
Source File: SolarisAttachProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new SolarisVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #5
Source File: JCmd.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
Example #6
Source File: SolarisAttachProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new SolarisVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #7
Source File: LinuxAttachProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #8
Source File: LinuxAttachProvider.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #9
Source File: JCmd.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
Example #10
Source File: SolarisAttachProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new SolarisVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #11
Source File: SolarisAttachProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new SolarisVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #12
Source File: BsdAttachProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new BsdVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #13
Source File: LinuxAttachProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #14
Source File: AixAttachProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new AixVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #15
Source File: JCmd.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
Example #16
Source File: JCmd.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
Example #17
Source File: BsdAttachProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new BsdVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #18
Source File: LinuxAttachProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #19
Source File: BsdAttachProvider.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new BsdVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #20
Source File: AixAttachProvider.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new AixVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #21
Source File: BsdAttachProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new BsdVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #22
Source File: SolarisAttachProvider.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new SolarisVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #23
Source File: LinuxAttachProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #24
Source File: AixAttachProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new AixVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #25
Source File: JCmd.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
Example #26
Source File: JCmd.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
Example #27
Source File: JMXConnection.java    From OpenFalcon-SuitAgent with Apache License 2.0 6 votes vote down vote up
private JMXConnectUrlInfo getConnectorAddress(VirtualMachineDescriptor desc){
    if(AgentConfiguration.INSTANCE.isAgentJMXLocalConnect()){
        String connectorAddress = AbstractJmxCommand.findJMXLocalUrlByProcessId(Integer.parseInt(desc.id()));
        if(connectorAddress != null){
            return new JMXConnectUrlInfo(connectorAddress);
        }
    }

    JMXConnectUrlInfo jmxConnectUrlInfo = null;
    try {
        jmxConnectUrlInfo = AbstractJmxCommand.findJMXRemoteUrlByProcessId(Integer.parseInt(desc.id()), InetAddress.getLocalHost().getHostAddress());
        if(jmxConnectUrlInfo != null){
            log.info("JMX Remote URL:{}",jmxConnectUrlInfo);
        }else if(!AgentConfiguration.INSTANCE.isAgentJMXLocalConnect()){
            log.warn("应用未配置JMX Remote功能,请给应用配置JMX Remote");
        }
    } catch (UnknownHostException e) {
        log.error("JMX连接本机地址获取失败",e);
    }
    return jmxConnectUrlInfo;
}
 
Example #28
Source File: LinuxAttachProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #29
Source File: LinuxAttachProvider.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new LinuxVirtualMachine(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}
 
Example #30
Source File: AttachProviderImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
    throws AttachNotSupportedException, IOException
{
    if (vmd.provider() != this) {
        throw new AttachNotSupportedException("provider mismatch");
    }
    // To avoid re-checking if the VM if attachable, we check if the descriptor
    // is for a hotspot VM - these descriptors are created by the listVirtualMachines
    // implementation which only returns a list of attachable VMs.
    if (vmd instanceof HotSpotVirtualMachineDescriptor) {
        assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
        checkAttachPermission();
        return new VirtualMachineImpl(this, vmd.id());
    } else {
        return attachVirtualMachine(vmd.id());
    }
}