Closes gh-4572
This commit is contained in:
Johnny Lim
2015-11-21 12:12:05 +09:00
committed by Stephane Nicoll
parent 31d7ebc96e
commit 8ec00c35bf
40 changed files with 70 additions and 70 deletions

View File

@@ -28,14 +28,14 @@ import java.util.List;
*/
public abstract class AgentAttacher {
private static final String VIRTUAL_MACHINE_CLASSNAME = "com.sun.tools.attach.VirtualMachine";
private static final String VIRTUAL_MACHINE_CLASS_NAME = "com.sun.tools.attach.VirtualMachine";
public static void attach(File agent) {
try {
String name = ManagementFactory.getRuntimeMXBean().getName();
String pid = name.substring(0, name.indexOf('@'));
ClassLoader classLoader = JvmUtils.getToolsClassLoader();
Class<?> vmClass = classLoader.loadClass(VIRTUAL_MACHINE_CLASSNAME);
Class<?> vmClass = classLoader.loadClass(VIRTUAL_MACHINE_CLASS_NAME);
Method attachMethod = vmClass.getDeclaredMethod("attach", String.class);
Object vm = attachMethod.invoke(null, pid);
Method loadAgentMethod = vmClass.getDeclaredMethod("loadAgent", String.class);

View File

@@ -34,7 +34,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
* Tests fir {@link FileUtils}.
* Tests for {@link FileUtils}.
*
* @author Dave Syer
* @author Phillip Webb