All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.classloading.HotswapAgent Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package play.classloading;

import java.lang.instrument.ClassDefinition;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;

/**
 * Enable HotSwap when it's possible.
 */
public class HotswapAgent {

    static Instrumentation instrumentation;
    public static boolean enabled = false;

    public static void premain(String agentArgs, Instrumentation instrumentation) {
        HotswapAgent.instrumentation = instrumentation;
        HotswapAgent.enabled = true;
    }

    public static void reload(ClassDefinition... definitions) throws UnmodifiableClassException, ClassNotFoundException {
        instrumentation.redefineClasses(definitions);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy