404906 servlets with load-on-startup = 0 are not fired up on jetty 9 startup

This commit is contained in:
Jan Bartel 2013-04-08 09:58:08 +10:00
parent 44ec0b3f49
commit 0965ca62e2
2 changed files with 4 additions and 5 deletions

View File

@ -71,7 +71,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; private int _initOrder = -1;
private boolean _initOnStartup=false; private boolean _initOnStartup=false;
private Map<String, String> _roleMap; private Map<String, String> _roleMap;
private String _forcedPath; private String _forcedPath;
@ -179,7 +179,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
*/ */
public void setInitOrder(int order) public void setInitOrder(int order)
{ {
_initOnStartup=order>0; _initOnStartup=order>=0;
_initOrder = order; _initOrder = order;
} }
@ -329,7 +329,6 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
throws Exception throws Exception
{ {
super.initialize(); super.initialize();
if (_extInstance || _initOnStartup) if (_extInstance || _initOnStartup)
{ {
try try

View File

@ -130,8 +130,8 @@ public class ServletContextHandlerTest
holder0.setInitOrder(0); holder0.setInitOrder(0);
_server.start(); _server.start();
assertEquals(2,__testServlets.get()); assertEquals(3,__testServlets.get());
assertThat(holder0.getServletInstance(),nullValue()); assertThat(holder0.getServletInstance(),notNullValue(Servlet.class));
_server.stop(); _server.stop();
assertEquals(0,__testServlets.get()); assertEquals(0,__testServlets.get());