Skip to content

Commit

Permalink
auto recreate JetEngine on webapp reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
subchen committed Nov 25, 2014
1 parent 00fd75d commit 5edf2ea
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jetbrick.config.ConfigLoader;
import jetbrick.template.*;
import jetbrick.template.loader.ServletResourceLoader;
import jetbrick.template.web.buildin.JetWebFunctions;
import jetbrick.template.web.buildin.JetWebTags;
import jetbrick.web.servlet.map.ServletContextAttributeMap;
import org.slf4j.Logger;
Expand All @@ -49,7 +50,10 @@ public static JetEngine create(ServletContext sc) {

public static JetEngine create(ServletContext sc, Properties config, String configLocation) {
if (engine != null) {
throw new IllegalStateException("JetEngine has been created");
if (JetWebEngine.sc == sc) {
return engine;
}
log.warn("webapp reloading: recreating the JetEngine ...");
}

JetWebEngine.sc = sc;
Expand Down

0 comments on commit 5edf2ea

Please sign in to comment.