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


Java Bootstrap.virtualMachineManager方法代码示例

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


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

示例1: connect

import com.sun.jdi.Bootstrap; //导入方法依赖的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: attach

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例3: launch

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例4: test

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例5: getConnector

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例6: connect

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例7: getConnector

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例8: attach

import com.sun.jdi.Bootstrap; //导入方法依赖的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

示例9: connectedVirtualMachines

import com.sun.jdi.Bootstrap; //导入方法依赖的package包/类
public List<VirtualMachine> connectedVirtualMachines() {
    VirtualMachineManager pvmm = Bootstrap.virtualMachineManager();
    return F3Wrapper.wrapVirtualMachines(pvmm.connectedVirtualMachines());
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3Bootstrap.java

示例10: createVirtualMachine

import com.sun.jdi.Bootstrap; //导入方法依赖的package包/类
public VirtualMachine createVirtualMachine(Connection connection, 
        Process process) throws IOException {
    VirtualMachineManager pvmm = Bootstrap.virtualMachineManager();
    return F3Wrapper.wrap(pvmm.createVirtualMachine(connection, process));
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:6,代码来源:F3Bootstrap.java


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