mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
listen to restart events in every stage, not only development
This commit is contained in:
@@ -33,14 +33,16 @@ package sonia.scm.boot;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.Stage;
|
||||
import sonia.scm.event.Event;
|
||||
|
||||
/**
|
||||
* This event can be used to force a restart of the webapp context. The restart
|
||||
* event is useful during plugin development, because we don't have to restart
|
||||
* the whole server, to see our changes. The restart event can only be used in
|
||||
* stage {@link Stage#DEVELOPMENT}.
|
||||
* the whole server, to see our changes. The restart event could also be used
|
||||
* to install or upgrade plugins.
|
||||
*
|
||||
* But the restart event should be used carefully, because the whole context
|
||||
* will be restarted and that process could take some time.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 2.0.0
|
||||
|
||||
@@ -37,8 +37,6 @@ import com.github.legman.Subscribe;
|
||||
import com.google.inject.servlet.GuiceFilter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.SCMContext;
|
||||
import sonia.scm.Stage;
|
||||
import sonia.scm.event.ScmEventBus;
|
||||
|
||||
import javax.servlet.FilterConfig;
|
||||
@@ -99,12 +97,9 @@ public class BootstrapContextFilter extends GuiceFilter
|
||||
|
||||
initGuice();
|
||||
|
||||
if (SCMContext.getContext().getStage() == Stage.DEVELOPMENT)
|
||||
{
|
||||
logger.info("register for restart events");
|
||||
ScmEventBus.getInstance().register(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void initGuice() throws ServletException {
|
||||
super.init(filterConfig);
|
||||
|
||||
Reference in New Issue
Block a user