mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
clear ResteasyProviderFactory and RuntimeDelegate during restart
This change is required, because some cachings of resteasy are not cleared by removing them from ServletContext. Some classes use static or ThreadLocals, which are causing a ClassLoader leak. However this change will clear those caches.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package sonia.scm.boot;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.jboss.resteasy.spi.ResteasyProviderFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.ws.rs.ext.RuntimeDelegate;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -46,6 +48,10 @@ final class ServletContextCleaner {
|
||||
LOG.info("keep attribute {} in servlet context", name);
|
||||
}
|
||||
}
|
||||
|
||||
ResteasyProviderFactory.clearInstanceIfEqual(ResteasyProviderFactory.getInstance());
|
||||
ResteasyProviderFactory.clearContextData();
|
||||
RuntimeDelegate.setInstance(null);
|
||||
}
|
||||
|
||||
private static boolean shouldRemove(String name) {
|
||||
|
||||
Reference in New Issue
Block a user