当前位置: 首页>>代码示例>>Java>>正文


Java LinuxVirtualMachine类代码示例

本文整理汇总了Java中sun.tools.attach.LinuxVirtualMachine的典型用法代码示例。如果您正苦于以下问题:Java LinuxVirtualMachine类的具体用法?Java LinuxVirtualMachine怎么用?Java LinuxVirtualMachine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LinuxVirtualMachine类属于sun.tools.attach包,在下文中一共展示了LinuxVirtualMachine类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrieveOsDepentVmImplementation

import sun.tools.attach.LinuxVirtualMachine; //导入依赖的package包/类
/**
 * Retrieves and attaches to the currently running JVM and return the
 * correct implementation of {@link VirtualMachine} for the current OS.
 *
 * <p>
 * <b> NOTE: Supported operating systems are: Windows, BSD, Linux and
 * Solaris. </b>
 * </p>
 *
 * @return The attached {@link VirtualMachine}.
 * @throws AttachNotSupportedException
 *             If the current JVM does not support attachments.
 * @throws IOException
 *             If any I/O error occurs.
 */
private VirtualMachine retrieveOsDepentVmImplementation() throws AttachNotSupportedException, IOException {
    switch (OperatingSystem.detect()) {
        case WINDOWS:
            InterceptionAgent.LOGGER.debug("Attaching to window vm.");

            return new WindowsVirtualMachine(InterceptionAgent.ATTACH_PROVIDER, this.retrieveJvmId());
        case MAC:
            InterceptionAgent.LOGGER.debug("Attaching to bsd vm.");

            return new BsdVirtualMachine(InterceptionAgent.ATTACH_PROVIDER, this.retrieveJvmId());
        case UNIX:
            InterceptionAgent.LOGGER.debug("Attaching to linux vm.");

            return new LinuxVirtualMachine(InterceptionAgent.ATTACH_PROVIDER, this.retrieveJvmId());
        case SOLARIS:
            InterceptionAgent.LOGGER.debug("Attaching to solaris vm.");

            return new SolarisVirtualMachine(InterceptionAgent.ATTACH_PROVIDER, this.retrieveJvmId());
        default:
            throw new AttachNotSupportedException("Operating system " + OperatingSystem.get() + " not supported!");
    }
}
 
开发者ID:Blockhaus2000,项目名称:InternalPluginManager,代码行数:38,代码来源:InterceptionAgent.java


注:本文中的sun.tools.attach.LinuxVirtualMachine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。