Package org.jrd.backend.communication
Class InstallDecompilerAgentImpl
- java.lang.Object
-
- org.jrd.backend.communication.InstallDecompilerAgentImpl
-
public final class InstallDecompilerAgentImpl extends java.lang.ObjectThis 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 booleanaddToBootprivate java.lang.StringagentJarprivate Configconfigprivate java.lang.Stringhostprivate java.lang.Stringidprivate AgentLonelinesslonelinessprivate intportprivate java.lang.Stringpropsprivate booleansetPolicyprivate com.sun.tools.attach.VirtualMachinevm
-
Constructor Summary
Constructors Modifier Constructor Description privateInstallDecompilerAgentImpl(java.lang.String pid, boolean addToBoot, boolean setPolicy, java.lang.String host, int port, AgentLoneliness loneliness, java.lang.String[] properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidattach()attach to the Java process identified by the process id supplied on the command linejava.lang.StringgetHost()java.lang.StringgetPid()intgetPort()private voidinjectAgent()get the attached process to upload and install the agent jar using whatever agent options were configured on the command linestatic voidinstall(java.lang.String pid, boolean addToBoot, boolean setPolicy, java.lang.String host, int port, AgentLoneliness loneliness, AgentLiveliness liveliness, java.lang.String[] properties)private voidlocateAgent()java.lang.StringtoString()
-
-
-
Field Detail
-
agentJar
private java.lang.String agentJar
-
id
private final java.lang.String id
-
port
private final int port
-
host
private final java.lang.String host
-
addToBoot
private final boolean addToBoot
-
setPolicy
private final boolean setPolicy
-
props
private final java.lang.String props
-
vm
private com.sun.tools.attach.VirtualMachine vm
-
loneliness
private final AgentLoneliness loneliness
-
config
private final Config config
-
-
Constructor Detail
-
InstallDecompilerAgentImpl
private InstallDecompilerAgentImpl(java.lang.String pid, boolean addToBoot, boolean setPolicy, java.lang.String host, int port, AgentLoneliness loneliness, 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, AgentLoneliness loneliness, AgentLiveliness liveliness, 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.IllegalArgumentExceptionjava.io.IOExceptioncom.sun.tools.attach.AttachNotSupportedExceptioncom.sun.tools.attach.AgentLoadExceptioncom.sun.tools.attach.AgentInitializationException
-
attach
private void attach() throws com.sun.tools.attach.AttachNotSupportedException, java.io.IOException, java.lang.IllegalArgumentExceptionattach to the Java process identified by the process id supplied on the command line- Throws:
com.sun.tools.attach.AttachNotSupportedExceptionjava.io.IOExceptionjava.lang.IllegalArgumentException
-
injectAgent
private void injectAgent() throws com.sun.tools.attach.AgentLoadException, com.sun.tools.attach.AgentInitializationException, java.io.IOExceptionget 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.AgentLoadExceptioncom.sun.tools.attach.AgentInitializationExceptionjava.io.IOException
-
locateAgent
private void locateAgent() throws java.io.IOException- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getPort
public int getPort()
-
getHost
public java.lang.String getHost()
-
getPid
public java.lang.String getPid()
-
-