Chapter 2 - Jetty读取配置文件和Loader(3)
Server的启动
AbstractLifeCycle实现了LifeCycle接口(start(), stop()),并提供了doStart()和doStop()方法
protected void doStart() throws Exception { for (int i=0;_realms !=null && i<_realms.length; i++) { if (_realms[i] instanceof LifeCycle) ((LifeCycle)_realms[i]).start(); } Iterator itor = _dependentLifeCycles.iterator(); while (itor.hasNext()) { try { ((LifeCycle)itor.next()).start(); } catch (Throwable e) {mex.add(e);} } if (_threadPool==null) { QueuedThreadPool tp=new QueuedThreadPool(); setThreadPool(tp); } if (_sessionIdManager!=null) _sessionIdManager.start(); try { if (_threadPool instanceof LifeCycle) ((LifeCycle)_threadPool).start(); } catch(Throwable e) { mex.add(e);} try { super.doStart(); } catch(Throwable e) { Log.warn("Error starting handlers",e); } if (_connectors!=null) { for (int i=0;i<_connectors.length;i++) { try{_connectors[i].start();} catch(Throwable e) { mex.add(e); } } } mex.ifExceptionThrow(); }