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


Java IllegalConnectorArgumentsException类代码示例

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


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

示例1: connect

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的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: doTestBreakpointComplete

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
private void doTestBreakpointComplete (
    int line, 
    String condition, 
    int conditionResult
) throws IOException, IllegalConnectorArgumentsException,
DebuggerStartException {
    try {
        LineBreakpoint lb = doTestBreakpoint (
            line, 
            condition, 
            conditionResult
        );
        if ( condition == null || 
             conditionResult == JPDABreakpointEvent.CONDITION_TRUE
        ) {
            support.doContinue();
            support.waitState (JPDADebugger.STATE_DISCONNECTED);
        }
        DebuggerManager.getDebuggerManager ().removeBreakpoint (lb);
    } finally {
        if (support != null) support.doFinish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:LineBreakpointTest.java

示例3: generalGetVM

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
static private VirtualMachine generalGetVM(OutputListener diagnostics,
                                           LaunchingConnector connector,
                                           Map<String, Connector.Argument> arguments) {
    VirtualMachine vm = null;
    try {
        diagnostics.putString("Starting child.");
        vm = connector.launch(arguments);
    } catch (IOException ioe) {
        diagnostics.putString("Unable to start child: " + ioe.getMessage());
    } catch (IllegalConnectorArgumentsException icae) {
        diagnostics.putString("Unable to start child: " + icae.getMessage());
    } catch (VMStartException vmse) {
        diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n');
        dumpFailedLaunchInfo(diagnostics, vmse.process());
    }
    return vm;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ChildSession.java

示例4: launch

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
public VirtualMachine
    launch(Map<String, ? extends Connector.Argument> arguments)
    throws IOException, IllegalConnectorArgumentsException,
           VMStartException
{
    String command = argument(ARG_COMMAND, arguments).value();
    String address = argument(ARG_ADDRESS, arguments).value();
    String quote = argument(ARG_QUOTE, arguments).value();

    if (quote.length() > 1) {
        throw new IllegalConnectorArgumentsException("Invalid length",
                                                     ARG_QUOTE);
    }

    TransportService.ListenKey listener = transportService.startListening(address);

    try {
        return launch(tokenizeCommand(command, quote.charAt(0)),
                      address, listener, transportService);
    } finally {
        transportService.stopListening(listener);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:RawCommandLineLauncher.java

示例5: startListening

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
public String
    startListening(Map<String,? extends Connector.Argument> args)
    throws IOException, IllegalConnectorArgumentsException
{
    String port = argument(ARG_PORT, args).value();
    String localaddr = argument(ARG_LOCALADDR, args).value();

    // default to system chosen port
    if (port.length() == 0) {
        port = "0";
    }

    if (localaddr.length() > 0) {
       localaddr = localaddr + ":" + port;
    } else {
       localaddr = port;
    }

    return super.startListening(localaddr, args);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:SocketListeningConnector.java

示例6: tryDebug

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
private static void tryDebug(long pid) throws IOException,
        IllegalConnectorArgumentsException {
    AttachingConnector ac = Bootstrap.virtualMachineManager().attachingConnectors()
            .stream()
            .filter(c -> c.name().equals("com.sun.jdi.ProcessAttach"))
            .findFirst()
            .orElseThrow(() -> new RuntimeException("Unable to locate ProcessAttachingConnector"));

    Map<String, Connector.Argument> args = ac.defaultArguments();
    Connector.StringArgument arg = (Connector.StringArgument) args
            .get("pid");
    arg.setValue("" + pid);

    System.out.println("Debugger is attaching to: " + pid + " ...");
    VirtualMachine vm = ac.attach(args);

    // list all threads
    System.out.println("Attached! Now listing threads ...");
    vm.allThreads().stream().forEach(System.out::println);

    System.out.println("Debugger done.");
    vm.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ProcessAttachTest.java

示例7: launch

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

示例8: attach

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

示例9: get

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
/** Try to get an instrumentation instance using JDWP */
public static synchronized JDWPAgent get() throws IOException, IllegalConnectorArgumentsException {
    // There can be only one
    if (instance != null) {
        return instance;
    }
    
    // Get the JDWP port
    Properties props = sun.misc.VMSupport.getAgentProperties();
    String jdwp_address = props.getProperty("sun.jdwp.listenerAddress");
    
    // If no JDWP address, then the debug argument isn't included
    if (jdwp_address == null) {
        System.err.println("Could not acquire JDWP address to attach dynamic instrumentation. "
                + "Ensure JVM runs with argument -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0");
        return null;
    }
    
    // Extract the port and return the instance;
    System.out.println("JDWPAgent started with address " + jdwp_address);
    String jdwp_port = jdwp_address.substring(jdwp_address.lastIndexOf(':') + 1);
    instance = new JDWPAgent(jdwp_port);
    return instance;
}
 
开发者ID:brownsys,项目名称:tracing-framework,代码行数:25,代码来源:JDWPAgent.java

示例10: testBadModification2

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
@Test
public void testBadModification2() throws ClassNotFoundException, AgentLoadException, AgentInitializationException, IOException, AttachNotSupportedException, UnmodifiableClassException, IllegalConnectorArgumentsException {
    // Rewrite method
    DynamicModification badModification = new DynamicModification() {
        public Collection<String> affects() {
            return Lists.newArrayList(TestJDWPAgentDebug.class.getName());
        }
        public void apply(ClassPool arg0) throws NotFoundException, CannotCompileException {
            CtClass cls = arg0.getCtClass(TestJDWPAgentDebug.class.getName());
            cls.getMethods()[0].insertBefore("definitely not code...");
        }
    };
    JDWPAgent dynamic = JDWPAgent.get();
    // Modification should just be ignored since it throws a notfoundexception
    try {
        dynamic.install(badModification);
        fail();
    } catch (CannotCompileException e) {
    }
}
 
开发者ID:brownsys,项目名称:tracing-framework,代码行数:21,代码来源:TestJDWPAgentDebug.java

示例11: HotSwapperJpda

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
/**
 * Connects to the JVM.
 *
 * @param port the port number used for the connection to the JVM.
 */
public HotSwapperJpda(String port)
        throws IOException, IllegalConnectorArgumentsException {
    jvm = null;
    request = null;
    newClassFiles = null;
    trigger = new Trigger();
    AttachingConnector connector
            = (AttachingConnector) findConnector("com.sun.jdi.SocketAttach");

    Map arguments = connector.defaultArguments();
    ((Connector.Argument) arguments.get("hostname")).setValue(HOST_NAME);
    ((Connector.Argument) arguments.get("port")).setValue(port);
    jvm = connector.attach(arguments);
    EventRequestManager manager = jvm.eventRequestManager();
    request = methodEntryRequests(manager, TRIGGER_NAME);
}
 
开发者ID:HotswapProjects,项目名称:HotswapAgent,代码行数:22,代码来源:HotSwapperJpda.java

示例12: getVirtualMachine

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
/**
 * Creates a new instance of VirtualMachine for this DebuggerInfo Cookie.
 *
 * @return a new instance of VirtualMachine for this DebuggerInfo Cookie
 * @throws java.io.IOException when unable to attach.
 * @throws IllegalConnectorArgumentsException when some connector argument is invalid.
 */
@Override
public VirtualMachine getVirtualMachine () throws IOException,
IllegalConnectorArgumentsException {
    try {
        return attachingConnector.attach (args);
    } catch (IOException ioex) {
        String msg = "Attaching Connector = "+attachingConnector+", arguments = "+args; // NOI18N
        logger.log(Level.INFO, msg, ioex);
        throw ioex;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AttachingDICookie.java

示例13: doTestBreakpoint

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
private LineBreakpoint doTestBreakpoint (
    int         line, 
    String      condition, 
    int         conditionResult
) throws IOException, IllegalConnectorArgumentsException, 
DebuggerStartException {
    JPDASupport.removeAllBreakpoints ();
    LineBreakpoint lb = LineBreakpoint.create (TEST_APP, line);
    /*
    if (73 <= line && line <= 98) {
        lb.setPreferredClassName("org.netbeans.api.debugger.jpda.testapps.LineBreakpointApp$InnerStatic");
    } else if (100 <= line && line <= 115) {
        lb.setPreferredClassName("org.netbeans.api.debugger.jpda.testapps.LineBreakpointApp$Inner");
    }
     */
    lb.setCondition (condition);
    TestBreakpointListener tbl = new TestBreakpointListener 
        (lb, conditionResult);
    lb.addJPDABreakpointListener (tbl);
    DebuggerManager.getDebuggerManager ().addBreakpoint (lb);

    support = JPDASupport.attach (
        "org.netbeans.api.debugger.jpda.testapps.LineBreakpointApp"
    );

    if ( condition == null || 
         conditionResult == JPDABreakpointEvent.CONDITION_TRUE
    ) {
        support.waitState (JPDADebugger.STATE_STOPPED);
    } else {
        support.waitState (JPDADebugger.STATE_DISCONNECTED);
    }

    tbl.checkResult ();
    return lb;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:LineBreakpointTest.java

示例14: launch

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:SimpleLaunchingConnector.java

示例15: startListening

import com.sun.jdi.connect.IllegalConnectorArgumentsException; //导入依赖的package包/类
public String startListening(String address, Map<String,? extends Connector.Argument> args)
    throws IOException, IllegalConnectorArgumentsException
{
    TransportService.ListenKey listener = listenMap.get(args);
    if (listener != null) {
       throw new IllegalConnectorArgumentsException("Already listening",
           new ArrayList<>(args.keySet()));
    }

    listener = transportService.startListening(address);
    listenMap.put(args, listener);
    return listener.address();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:GenericListeningConnector.java


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