Class InstallDecompilerAgentImpl


  • public final class InstallDecompilerAgentImpl
    extends java.lang.Object
    This is Byteman's install library copied, with small modifications. This is done with permission of Andrew Dinn, author of Byteman. For the original source of this code, please follow links below: http://byteman.jboss.org/ -- official page https://github.com/bytemanproject/byteman -- git repository This is a provisional solution for the attachment, while I am trying to create an abstract library to share some functionality.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean addToBoot  
      private java.lang.String agentJar  
      private Config config  
      private java.lang.String host  
      private java.lang.String id  
      private int port  
      private java.lang.String props  
      private boolean setPolicy  
      private com.sun.tools.attach.VirtualMachine vm  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private InstallDecompilerAgentImpl​(java.lang.String pid, boolean addToBoot, boolean setPolicy, java.lang.String host, int port, java.lang.String[] properties)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void attach()
      attach to the Java process identified by the process id supplied on the command line
      private void injectAgent()
      get the attached process to upload and install the agent jar using whatever agent options were configured on the command line
      static void install​(java.lang.String pid, boolean addToBoot, boolean setPolicy, java.lang.String host, int port, java.lang.String[] properties)  
      private void locateAgent()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • agentJar

        private java.lang.String agentJar
      • id

        private java.lang.String id
      • port

        private int port
      • host

        private java.lang.String host
      • addToBoot

        private boolean addToBoot
      • setPolicy

        private boolean setPolicy
      • props

        private java.lang.String props
      • vm

        private com.sun.tools.attach.VirtualMachine vm
      • config

        private Config config
    • Constructor Detail

      • InstallDecompilerAgentImpl

        private InstallDecompilerAgentImpl​(java.lang.String pid,
                                           boolean addToBoot,
                                           boolean setPolicy,
                                           java.lang.String host,
                                           int port,
                                           java.lang.String[] properties)
    • Method Detail

      • install

        public static void install​(java.lang.String pid,
                                   boolean addToBoot,
                                   boolean setPolicy,
                                   java.lang.String host,
                                   int port,
                                   java.lang.String[] properties)
                            throws java.lang.IllegalArgumentException,
                                   java.io.IOException,
                                   com.sun.tools.attach.AttachNotSupportedException,
                                   com.sun.tools.attach.AgentLoadException,
                                   com.sun.tools.attach.AgentInitializationException
        Throws:
        java.lang.IllegalArgumentException
        java.io.IOException
        com.sun.tools.attach.AttachNotSupportedException
        com.sun.tools.attach.AgentLoadException
        com.sun.tools.attach.AgentInitializationException
      • attach

        private void attach()
                     throws com.sun.tools.attach.AttachNotSupportedException,
                            java.io.IOException,
                            java.lang.IllegalArgumentException
        attach to the Java process identified by the process id supplied on the command line
        Throws:
        com.sun.tools.attach.AttachNotSupportedException
        java.io.IOException
        java.lang.IllegalArgumentException
      • injectAgent

        private void injectAgent()
                          throws com.sun.tools.attach.AgentLoadException,
                                 com.sun.tools.attach.AgentInitializationException,
                                 java.io.IOException
        get the attached process to upload and install the agent jar using whatever agent options were configured on the command line
        Throws:
        com.sun.tools.attach.AgentLoadException
        com.sun.tools.attach.AgentInitializationException
        java.io.IOException
      • locateAgent

        private void locateAgent()
                          throws java.io.IOException
        Throws:
        java.io.IOException