Add initialized boolean to ServletHolder

Signed-off-by: wouter.bancken@aca-it.be
This commit is contained in:
Wouter Bancken 2015-09-30 13:29:01 +02:00 committed by Jan Bartel
parent f2e0a46058
commit 35cbe3308b
1 changed files with 16 additions and 13 deletions

View File

@ -73,6 +73,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
private static final Logger LOG = Log.getLogger(ServletHolder.class); private static final Logger LOG = Log.getLogger(ServletHolder.class);
private int _initOrder = -1; private int _initOrder = -1;
private boolean _initOnStartup=false; private boolean _initOnStartup=false;
private boolean initialized = false;
private Map<String, String> _roleMap; private Map<String, String> _roleMap;
private String _forcedPath; private String _forcedPath;
private String _runAsRole; private String _runAsRole;
@ -81,7 +82,6 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
private ServletRegistration.Dynamic _registration; private ServletRegistration.Dynamic _registration;
private JspContainer _jspContainer; private JspContainer _jspContainer;
private transient Servlet _servlet; private transient Servlet _servlet;
private transient Config _config; private transient Config _config;
private transient long _unavailable; private transient long _unavailable;
@ -396,21 +396,24 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
public void initialize () public void initialize ()
throws Exception throws Exception
{ {
super.initialize(); if(!initialized){
if (_extInstance || _initOnStartup) super.initialize();
{ if (_extInstance || _initOnStartup)
try
{ {
initServlet(); try
} {
catch(Exception e) initServlet();
{ }
if (_servletHandler.isStartWithUnavailable()) catch(Exception e)
LOG.ignore(e); {
else if (_servletHandler.isStartWithUnavailable())
throw e; LOG.ignore(e);
else
throw e;
}
} }
} }
initialized = true;
} }