Package com.sun.tools.attach

Examples of com.sun.tools.attach.VirtualMachine.loadAgent()


        if (connectorAddress == null) {
            String agent = vm.getSystemProperties().getProperty(
                    "java.home") + File.separator + "lib" + File.separator +
                    "management-agent.jar";
            try {
                vm.loadAgent(agent);
            } catch (Exception e) {
                throw new IllegalStateException("Exception loading agent " + agent);
            }
            connectorAddress = vm.getAgentProperties().getProperty(
                    "com.sun.management.jmxremote.localConnectorAddress");
View Full Code Here


        if (connectorAddress == null) {
            String agent = vm.getSystemProperties().getProperty(
                    "java.home") + File.separator + "lib" + File.separator +
                    "management-agent.jar";
            try {
                vm.loadAgent(agent);
            } catch (Exception e) {
                throw new IllegalStateException("Exception loading agent " + agent);
            }
            connectorAddress = vm.getAgentProperties().getProperty(
                    "com.sun.management.jmxremote.localConnectorAddress");
View Full Code Here

            if (!agentJar.isFile()) {
                logger.log(Level.WARNING, MISSING_AGENT_JAR, dir);
                return false;
            }

            vm.loadAgent(SmartFile.sanitize(agentJar.getPath()), options);
            isAttached = true;
        }
        catch (Throwable t) {
            logger.log(Level.WARNING, ATTACH_AGENT_EXCEPTION, t.getMessage());
            isAttached = false;
View Full Code Here

        final String[]       ary      = jarpaths.split(File.pathSeparator);
        final String         agentJar = Classpath.findJar(ary, "scalive");
        final VirtualMachine vm       = VirtualMachine.attach(pid);
        final int            port     = Client.getFreePort();

        vm.loadAgent(agentJar, jarpaths + " " + port);
        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override public void run() {
                try {
                    vm.detach();
                } catch (Exception e) {
View Full Code Here

        VirtualMachine vm = VirtualMachine.attach(id);
        String connectorAddr = vm.getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
        if (connectorAddr == null) {
            String agent = vm.getSystemProperties().getProperty("java.home")+File.separator+"lib"+File.separator+
                           "management-agent.jar";
            vm.loadAgent(agent);
            connectorAddr = vm.getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
        }
        MBeanServerConnection mbs = null;
        if(connectorAddr!=null) {
            JMXServiceURL serviceURL = new JMXServiceURL(connectorAddr);
View Full Code Here

            }
        }
        System.out.println("LOADING "+jar);
        try {
            VirtualMachine virtualMachine = VirtualMachine.attach(myID);
            virtualMachine.loadAgent(jar);
        } catch (Exception e) {
            e.printStackTrace();
        }
        instrumentation = AgentHook.getInstrumentation();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.