Skip to content

Commit

Permalink
do not clear the registry listener by default when reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantopo committed Oct 17, 2019
1 parent 3788663 commit f5b6412
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion agent/src/main/java/kanela/agent/Kanela.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,19 @@ public static void start(final String arguments, final Instrumentation instrumen
* modules to apply them on the current JVM.
*/
public static void reload() {
Kanela.reload(false);
}

/**
* Removes all instrumentation modules already applied by Kanela and re-scans the instrumentation class path for
* modules to apply them on the current JVM.
*/
public static void reload(boolean clearRegistry) {

// We will only proceed to reload if Kanela was properly started already.
if(Kanela.instrumentation != null) {
InstrumentationRegistryListener.instance().clear();
if(clearRegistry)
InstrumentationRegistryListener.instance().clear();

InstrumentationClassPath.build().use(instrumentationClassLoader -> {
installedTransformers.forEach(transformer -> instrumentation.removeTransformer(transformer.getClassFileTransformer()));
Expand Down

0 comments on commit f5b6412

Please sign in to comment.