本文整理汇总了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!");
}
}