mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55: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 --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.Stage;
|
|
||||||
import sonia.scm.event.Event;
|
import sonia.scm.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event can be used to force a restart of the webapp context. The restart
|
* 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
|
* 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
|
* the whole server, to see our changes. The restart event could also be used
|
||||||
* stage {@link Stage#DEVELOPMENT}.
|
* 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
|
* @author Sebastian Sdorra
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ import com.github.legman.Subscribe;
|
|||||||
import com.google.inject.servlet.GuiceFilter;
|
import com.google.inject.servlet.GuiceFilter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sonia.scm.SCMContext;
|
|
||||||
import sonia.scm.Stage;
|
|
||||||
import sonia.scm.event.ScmEventBus;
|
import sonia.scm.event.ScmEventBus;
|
||||||
|
|
||||||
import javax.servlet.FilterConfig;
|
import javax.servlet.FilterConfig;
|
||||||
@@ -99,12 +97,9 @@ public class BootstrapContextFilter extends GuiceFilter
|
|||||||
|
|
||||||
initGuice();
|
initGuice();
|
||||||
|
|
||||||
if (SCMContext.getContext().getStage() == Stage.DEVELOPMENT)
|
|
||||||
{
|
|
||||||
logger.info("register for restart events");
|
logger.info("register for restart events");
|
||||||
ScmEventBus.getInstance().register(this);
|
ScmEventBus.getInstance().register(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void initGuice() throws ServletException {
|
public void initGuice() throws ServletException {
|
||||||
super.init(filterConfig);
|
super.init(filterConfig);
|
||||||
|
|||||||
Reference in New Issue
Block a user