package ru.gravit.launcher; import java.io.IOException; import java.lang.instrument.Instrumentation; import java.util.jar.JarFile; import ru.gravit.utils.helper.LogHelper; @LauncherAPI public class LauncherAgent { private static boolean isAgentStarted = false; public static Instrumentation inst; public static void addJVMClassPath(String path) throws IOException { LogHelper.debug("Launcher Agent addJVMClassPath"); inst.appendToSystemClassLoaderSearch(new JarFile(path)); } public boolean isAgentStarted() { return isAgentStarted; } public static long getObjSize(Object obj) { return inst.getObjectSize(obj); } public static void premain(String agentArgument, Instrumentation instrumentation) { System.out.println("Launcher Agent"); inst = instrumentation; isAgentStarted = true; } public static boolean isStarted() { return isAgentStarted; } }