Skip to content

Instantly share code, notes, and snippets.

@jeanouii
Created July 8, 2014 18:05
Show Gist options
  • Select an option

  • Save jeanouii/01862f4751bfe0db5206 to your computer and use it in GitHub Desktop.

Select an option

Save jeanouii/01862f4751bfe0db5206 to your computer and use it in GitHub Desktop.
public void observeAssemblerBeforeApplicationDestroyed(@Observes final AssemblerAfterApplicationCreated event) {
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final AppContext appContext = containerSystem.getAppContext(event.getApp().appId);
final List<WebContext> webContexts = appContext.getWebContexts();
for (WebContext webContext : webContexts) {
final ClassLoader classLoader = webContext.getClassLoader();
final String id = webContext.getId();
TrackerService.get().registerClassloaderForAppId(id, classLoader);
}
}
public void observeAssemblerBeforeApplicationDestroyed(@Observes final AssemblerBeforeApplicationDestroyed event) {
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final AppContext appContext = containerSystem.getAppContext(event.getApp().appId);
final List<WebContext> webContexts = appContext.getWebContexts();
for (WebContext webContext : webContexts) {
final ClassLoader classLoader = webContext.getClassLoader();
TrackerService.get().unregisterClassloader(classLoader);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment