Examples of loadAgent()


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

          .getProperty("java.home")
          + File.separator
          + "lib"
          + File.separator
          + "management-agent.jar";
      vm.loadAgent(agent);

      // agent is started, get the connector address
      connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
    }
View Full Code Here

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

            perrorQuit("Attach to pid " + pid + " failed", e);
            throw new RuntimeException("should not get here");
        }

        try {
            vm.loadAgent(jarPath.getAbsolutePath(), duration + ";" + interval + ";" + port + ";" + output);
        } catch (com.sun.tools.attach.AgentLoadException e) {
            throw new RuntimeException(e);
        } catch (com.sun.tools.attach.AgentInitializationException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
View Full Code Here

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

                // to be multi-purposed. It acts as the java agent for the
                // static use case, the java agent for the dynamic use case and
                // also the command line utility to perform injecting the agent
                // for the dynamic use case.

                vm.loadAgent(HeapAudit.class.getProtectionDomain().getCodeSource().getLocation().getPath(),
                             s.toString());

            }
            catch (IOException e) {
View Full Code Here

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

            }
        }

        agent = f.getCanonicalPath();
        try {
            vm.loadAgent(agent, "com.sun.management.jmxremote");
        } catch (AgentLoadException x) {
            throw new IOException(x.getMessage(), x);
        } catch (AgentInitializationException x) {
            throw new IOException(x.getMessage(), x);
        }
View Full Code Here

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

            try {
                vm = VirtualMachine.attach(id);
                String connectorAddr = vm.getAgentProperties().getProperty(PROP_LOCAL_CONNECTOR_ADDRESS);
                if (connectorAddr == null && startAgent) {
                    final String agent = Paths.get(vm.getSystemProperties().getProperty(PROP_JAVA_HOME)).resolve(MANAGEMENT_AGENT).toString();
                    vm.loadAgent(agent);
                    connectorAddr = vm.getAgentProperties().getProperty(PROP_LOCAL_CONNECTOR_ADDRESS);
                }
                vm.detach();
                final JMXServiceURL url = connectorAddr != null ? new JMXServiceURL(connectorAddr) : null;
                return url;
View Full Code Here

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

            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

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

            GenerateScriptUtil.copy(bytemanInputJar, new FileOutputStream(bytemanJar));

            VirtualMachine vm = VirtualMachine.attach(pid);
            String agentProperties = config.agentProperties();
            vm.loadAgent(bytemanJar.getAbsolutePath(), "listener:true,port:" + config.containerAgentPort() + (agentProperties != null ? ",prop:" +  agentProperties:""));
            vm.detach();
        }
        catch (IOException e)
        {
            throw new RuntimeException("Could not write byteman.jar to disk", e);
View Full Code Here

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

            File bytemanJar = new File(bytemanLib, BytemanConfiguration.BYTEMAN_JAR);
            GenerateScriptUtil.copy(bytemanInputJar, new FileOutputStream(bytemanJar));

            VirtualMachine vm = VirtualMachine.attach(pid);
            String agentProperties = config.agentProperties();
            vm.loadAgent(bytemanJar.getAbsolutePath(), "listener:true,port:" + config.clientAgentPort() + (agentProperties != null ? ",prop:" +  agentProperties:""));
            vm.detach();
        }
        catch (IOException e)
        {
            throw new RuntimeException("Could not write byteman.jar to disk", e);
View Full Code Here

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

            if (!agentJar.isFile()) {
                logger.log(Level.WARNING, Strings.get("missing.agent.jar", dir));
                return false;
            }

            vm.loadAgent(SmartFile.sanitize(agentJar.getPath()), options);
            isAttached = true;
        }
        catch (Throwable t) {
            logger.warning(Strings.get("attach.agent.exception", t.getMessage()));
            isAttached = false;
View Full Code Here

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

        sb.append(port);
        String options = sb.toString();
        Integer pid = pids.get(0);
        final VirtualMachine vm = VirtualMachine.attach("" + pid);
        log.log(Level.INFO, "Loading agent with command " + options + " as agent " + agentFile.getCanonicalPath());
        vm.loadAgent(agentFile.getCanonicalPath(), options);
        server.accept();
        shell = server.getShell();
        closeable.add(new Closeable() {
          public void close() throws IOException {
            vm.detach();
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.