This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Instrumentation instrumentation() { | |
ClassLoader mainAppLoader = ClassLoader.getSystemClassLoader(); | |
try { | |
Class<?> javaAgentClass = mainAppLoader.loadClass("com.dlmu.agent.AgentTest"); | |
Method method = javaAgentClass.getDeclaredMethod("instrumentation", new Class[0]); | |
return (Instrumentation) method.invoke(null, new Object[0]); | |
} catch (Throwable e) { | |
System.out.println("can not get agent class" + e.getStackTrace()); | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dlmu.agent; | |
import java.lang.instrument.Instrumentation; | |
/** | |
* Created by fupan on 16-4-2. | |
*/ | |
public class AgentTest { | |
private static Instrumentation inst = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hey,hey,hey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dlmu.agent.test; | |
/** | |
* Created by fupan on 16-4-2. | |
*/ | |
public class HelloWorld { | |
public static void main(String[] args) { | |
System.out.println("hello, world."); | |
} |
NewerOlder