mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
fix re registration of BootstrapContextFilter after restart
This commit is contained in:
@@ -65,14 +65,14 @@ public class BootstrapContextFilter extends GuiceFilter {
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
this.filterConfig = filterConfig;
|
||||
|
||||
initGuice();
|
||||
initializeContext();
|
||||
}
|
||||
|
||||
private void initializeContext() throws ServletException {
|
||||
super.init(filterConfig);
|
||||
|
||||
LOG.info("register for restart events");
|
||||
ScmEventBus.getInstance().register(this);
|
||||
}
|
||||
|
||||
private void initGuice() throws ServletException {
|
||||
super.init(filterConfig);
|
||||
|
||||
listener.contextInitialized(new ServletContextEvent(filterConfig.getServletContext()));
|
||||
}
|
||||
@@ -80,6 +80,7 @@ public class BootstrapContextFilter extends GuiceFilter {
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
|
||||
listener.contextDestroyed(new ServletContextEvent(filterConfig.getServletContext()));
|
||||
ServletContextCleaner.cleanup(filterConfig.getServletContext());
|
||||
}
|
||||
@@ -107,7 +108,7 @@ public class BootstrapContextFilter extends GuiceFilter {
|
||||
@Override
|
||||
public void initialize() {
|
||||
try {
|
||||
BootstrapContextFilter.this.initGuice();
|
||||
BootstrapContextFilter.this.initializeContext();
|
||||
} catch (ServletException e) {
|
||||
throw new IllegalStateException("failed to initialize guice", e);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class InjectionContextRestartStrategy implements RestartStrategy {
|
||||
LOG.warn("reinitialize injection context");
|
||||
context.initialize();
|
||||
|
||||
LOG.debug("re register injection context for events");
|
||||
LOG.debug("register injection context on new eventbus");
|
||||
ScmEventBus.getInstance().register(context);
|
||||
} catch ( Exception ex) {
|
||||
LOG.error("failed to restart", ex);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package sonia.scm.boot;
|
||||
|
||||
import com.github.legman.Subscribe;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
Reference in New Issue
Block a user