读书人

Chapter 二 - Jetty读取配置文件和Loa

发布时间: 2012-10-16 09:57:37 作者: rapoo

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();    }

读书人网 >开源软件

热点推荐