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


Java VirtualMachineManager类代码示例

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


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

示例1: connect

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private VirtualMachine connect(int port) throws IOException {
	VirtualMachineManager manager = Bootstrap.virtualMachineManager();
	
	// Find appropiate connector
	List<AttachingConnector> connectors = manager.attachingConnectors();
	AttachingConnector chosenConnector = null;
	for (AttachingConnector c : connectors) {
		if (c.transport().name().equals(TRANSPORT_NAME)) {
			chosenConnector = c;
			break;
		}
	}
	if (chosenConnector == null) {
		throw new IllegalStateException("Could not find socket connector");
	}
	
	// Set port argument
	AttachingConnector connector = chosenConnector;
	Map<String, Argument> defaults = connector.defaultArguments();
	Argument arg = defaults.get(PORT_ARGUMENT_NAME);
	if (arg == null) {
		throw new IllegalStateException("Could not find port argument");
	}
	arg.setValue(Integer.toString(port));
	
	// Attach
	try {
		System.out.println("Connector arguments: " + defaults);
		return connector.attach(defaults);
	} catch (IllegalConnectorArgumentsException e) {
		throw new IllegalArgumentException("Illegal connector arguments", e);
	}
}
 
开发者ID:HotswapProjects,项目名称:HotswapAgent,代码行数:34,代码来源:JDIRedefiner.java

示例2: createVirtualMachine

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private VirtualMachine createVirtualMachine(Class vmImplClass,
                                            String debugServerName)
    throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    java.lang.reflect.Method connectByServerMethod =
                        vmImplClass.getMethod(
                               "createVirtualMachineForServer",
                               new Class[] {
                                   VirtualMachineManager.class,
                                   String.class,
                                   Integer.TYPE
                               });
    return (VirtualMachine) connectByServerMethod.invoke(null,
                               new Object[] {
                                   Bootstrap.virtualMachineManager(),
                                   debugServerName,
                                   new Integer(0)
                               });
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:19,代码来源:SADebugServerAttachingConnector.java

示例3: createVirtualMachine

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private VirtualMachine createVirtualMachine(Class vmImplClass,
                                            String javaExec, String corefile)
    throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    java.lang.reflect.Method connectByCoreMethod = vmImplClass.getMethod(
                             "createVirtualMachineForCorefile",
                              new Class[] {
                                  VirtualMachineManager.class,
                                  String.class, String.class,
                                  Integer.TYPE
                              });
    return (VirtualMachine) connectByCoreMethod.invoke(null,
                              new Object[] {
                                  Bootstrap.virtualMachineManager(),
                                  javaExec,
                                  corefile,
                                  new Integer(0)
                              });
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:19,代码来源:SACoreAttachingConnector.java

示例4: launch

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
/**
 * Launch a debuggee in suspend mode.
 * @see {@link #launch(VirtualMachineManager, String, String, String, String, String)}
 */
public static IDebugSession launch(VirtualMachineManager vmManager,
        String mainClass,
        String programArguments,
        String vmArguments,
        List<String> modulePaths,
        List<String> classPaths,
        String cwd,
        String[] envVars)
        throws IOException, IllegalConnectorArgumentsException, VMStartException {
    return DebugUtility.launch(vmManager,
            mainClass,
            programArguments,
            vmArguments,
            String.join(File.pathSeparator, modulePaths),
            String.join(File.pathSeparator, classPaths),
            cwd,
            envVars);
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:23,代码来源:DebugUtility.java

示例5: attach

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
public PermissionDebugger attach() throws IOException, IllegalConnectorArgumentsException {
  VirtualMachineManager vmm = Bootstrap.virtualMachineManager();

  List<AttachingConnector> connectors = vmm.attachingConnectors();
  AttachingConnector connector =
      connectors
          .stream()
          .filter(c -> c.transport().name().equals(transport))
          .findFirst()
          .orElseThrow(
              () -> new IOException(String.format("Failed to find transport %s", transport)));

  Map<String, Argument> map = connector.defaultArguments();
  Argument portArg = map.get(PORT_KEY);
  portArg.setValue(port);
  map.put(PORT_KEY, portArg);
  vm = connector.attach(map);

  return this;
}
 
开发者ID:coyotesqrl,项目名称:acdebugger,代码行数:21,代码来源:PermissionDebugger.java

示例6: launch

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
protected VirtualMachine launch(String[] commandArray, String address,
                                TransportService.ListenKey listenKey,
                                TransportService ts)
                                throws IOException, VMStartException {
    Helper helper = new Helper(commandArray, address, listenKey, ts);
    helper.launchAndAccept();

    VirtualMachineManager manager =
        Bootstrap.virtualMachineManager();

    return manager.createVirtualMachine(helper.connection(),
                                        helper.process());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:AbstractLauncher.java

示例7: virtualMachineManager

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
public static VirtualMachineManager virtualMachineManager() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        JDIPermission vmmPermission =
            new JDIPermission("virtualMachineManager");
        sm.checkPermission(vmmPermission);
    }
    synchronized (lock) {
        if (vmm == null) {
            vmm = new VirtualMachineManagerImpl();
        }
    }
    return vmm;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:VirtualMachineManagerImpl.java

示例8: getVirtualMachineManager

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
@Override
public synchronized VirtualMachineManager getVirtualMachineManager() {
    if (vmManager == null) {
        vmManager = new AdvancedVirtualMachineManager();
    }
    return vmManager;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:8,代码来源:JdtVirtualMachineManagerProvider.java

示例9: createVirtualMachine

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private VirtualMachine createVirtualMachine(Class virtualMachineImplClass, int pid)
    throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    java.lang.reflect.Method createByPIDMethod
              = virtualMachineImplClass.getMethod("createVirtualMachineForPID",
                 new Class[] {
                     VirtualMachineManager.class,
                     Integer.TYPE, Integer.TYPE
                 });
    return (VirtualMachine) createByPIDMethod.invoke(null,
                 new Object[] {
                     Bootstrap.virtualMachineManager(),
                     new Integer(pid),
                     new Integer(0)
                 });
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:16,代码来源:SAPIDAttachingConnector.java

示例10: test

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
@Test
public void test() {
    VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager();
    List<Connector> allConnectors = virtualMachineManager.allConnectors();
    List<VirtualMachine> connectedVirtualMachines = virtualMachineManager.connectedVirtualMachines();
    System.out.println(allConnectors);
    System.out.println(connectedVirtualMachines);


}
 
开发者ID:mercyblitz,项目名称:confucius-commons,代码行数:11,代码来源:LocalVirtualMachineTemplateTest.java

示例11: getConnector

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private AttachingConnector getConnector() {
    VirtualMachineManager vmManager = Bootstrap.virtualMachineManager();
    for (Connector connector : vmManager.attachingConnectors()) {
        if ("com.sun.jdi.SocketAttach".equals(connector.name())) {
            return (AttachingConnector) connector;
        }
    }
    throw new IllegalStateException();
}
 
开发者ID:SpoonLabs,项目名称:nopol,代码行数:10,代码来源:VMAcquirer.java

示例12: virtualMachineManager

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
public static VirtualMachineManager virtualMachineManager() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        JDIPermission vmmPermission =
                new JDIPermission("virtualMachineManager");
        sm.checkPermission(vmmPermission);
    }
    synchronized (lock) {
        if (vmm == null) {
            vmm = new F3VirtualMachineManager();
        }
    }
    return vmm;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:15,代码来源:F3Bootstrap.java

示例13: connect

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private VirtualMachine connect(int port) throws IOException {
    VirtualMachineManager manager = Bootstrap.virtualMachineManager();

    // Find appropiate connector
    List<AttachingConnector> connectors = manager.attachingConnectors();
    AttachingConnector chosenConnector = null;
    for (AttachingConnector c : connectors) {
        if (c.transport().name().equals(TRANSPORT_NAME)) {
            chosenConnector = c;
            break;
        }
    }
    if (chosenConnector == null) {
        throw new IllegalStateException("Could not find socket connector");
    }

    // Set port argument
    AttachingConnector connector = chosenConnector;
    Map<String, Argument> defaults = connector.defaultArguments();
    Argument arg = defaults.get(PORT_ARGUMENT_NAME);
    if (arg == null) {
        throw new IllegalStateException("Could not find port argument");
    }
    arg.setValue(Integer.toString(port));

    // Attach
    try {
        System.out.println("Connector arguments: " + defaults);
        return connector.attach(defaults);
    } catch (IllegalConnectorArgumentsException e) {
        throw new IllegalArgumentException("Illegal connector arguments", e);
    }
}
 
开发者ID:erkieh,项目名称:proxyhotswap,代码行数:34,代码来源:JDIRedefiner.java

示例14: getConnector

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
private AttachingConnector getConnector() {
  VirtualMachineManager vmManager = Bootstrap
      .virtualMachineManager();
  for (AttachingConnector connector : vmManager
      .attachingConnectors()) {
    if ("com.sun.jdi.SocketAttach".equals(connector
        .name())) {
      return (AttachingConnector) connector;
    }
  }
  throw new IllegalStateException();
}
 
开发者ID:gravel-st,项目名称:gravel,代码行数:13,代码来源:VMAcquirer.java

示例15: attach

import com.sun.jdi.VirtualMachineManager; //导入依赖的package包/类
public static JPDASupport attach (String mainClass, String[] args, File[] classPath) throws IOException,
DebuggerStartException {
    Process process = launchVM (mainClass, args, classPath, "", true);
    String line = readLine (process.getInputStream ());
    int port = Integer.parseInt (line.substring (line.lastIndexOf (':') + 1).trim ());
    ProcessIO pio = new ProcessIO (process);
    pio.go ();

    VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
    List aconnectors = vmm.attachingConnectors();
    AttachingConnector connector = null;
    for (Iterator i = aconnectors.iterator(); i.hasNext();) {
        AttachingConnector ac = (AttachingConnector) i.next();
        Transport t = ac.transport ();
        if (t != null && t.name().equals("dt_socket")) {
            connector = ac;
            break;
        }
    }
    if (connector == null) 
        throw new RuntimeException
            ("No attaching socket connector available");

    JPDADebugger jpdaDebugger = JPDADebugger.attach (
        "localhost", 
        port, 
        createServices ()
    );
    return new JPDASupport (jpdaDebugger);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:JPDASupport.java


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