亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? selectchannelconnector.java

?? 著名服務器nio的源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
// ========================================================================// Copyright 2003-2005 Mort Bay Consulting Pty. Ltd.// ------------------------------------------------------------------------// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.// ========================================================================package org.mortbay.jetty.nio;import java.io.IOException;import java.net.InetSocketAddress;import java.net.Socket;import java.nio.channels.SelectionKey;import java.nio.channels.ServerSocketChannel;import java.nio.channels.SocketChannel;import org.mortbay.io.Connection;import org.mortbay.io.nio.SelectChannelEndPoint;import org.mortbay.io.nio.SelectorManager;import org.mortbay.io.nio.SelectorManager.SelectSet;import org.mortbay.jetty.HttpConnection;import org.mortbay.jetty.Request;import org.mortbay.jetty.RetryRequest;import org.mortbay.log.Log;import org.mortbay.thread.Timeout;import org.mortbay.util.ajax.Continuation;/* ------------------------------------------------------------------------------- *//** * Selecting NIO connector. * <p> * This connector uses efficient NIO buffers with a non blocking threading model. Direct NIO buffers * are used and threads are only allocated to connections with requests. Synchronization is used to * simulate blocking for the servlet API, and any unflushed content at the end of request handling * is written asynchronously. * </p> * <p> * This connector is best used when there are a many connections that have idle periods. * </p> * <p> * When used with {@link org.mortbay.util.ajax.Continuation}, threadless waits are supported. When * a filter or servlet calls getEvent on a Continuation, a {@link org.mortbay.jetty.RetryRequest} * runtime exception is thrown to allow the thread to exit the current request handling. Jetty will * catch this exception and will not send a response to the client. Instead the thread is released * and the Continuation is placed on the timer queue. If the Continuation timeout expires, or it's * resume method is called, then the request is again allocated a thread and the request is retried. * The limitation of this approach is that request content is not available on the retried request, * thus if possible it should be read after the continuation or saved as a request attribute or as the * associated object of the Continuation instance. * </p> *  * @org.apache.xbean.XBean element="nioConnector" description="Creates an NIO based socket connector" *  * @author gregw * */public class SelectChannelConnector extends AbstractNIOConnector {    private transient ServerSocketChannel _acceptChannel;    private long _lowResourcesConnections;    private long _lowResourcesMaxIdleTime;    private SelectorManager _manager = new SelectorManager()    {        protected SocketChannel acceptChannel(SelectionKey key) throws IOException        {            // TODO handle max connections            SocketChannel channel = ((ServerSocketChannel)key.channel()).accept();            if (channel==null)                return null;            channel.configureBlocking(false);            Socket socket = channel.socket();            configure(socket);            return channel;        }        public boolean dispatch(Runnable task) throws IOException        {            return getThreadPool().dispatch(task);        }        protected void endPointClosed(SelectChannelEndPoint endpoint)        {            // TODO handle max connections and low resources            connectionClosed((HttpConnection)endpoint.getConnection());        }        protected void endPointOpened(SelectChannelEndPoint endpoint)        {            // TODO handle max connections and low resources            connectionOpened((HttpConnection)endpoint.getConnection());        }        protected Connection newConnection(SocketChannel channel,SelectChannelEndPoint endpoint)        {            return SelectChannelConnector.this.newConnection(channel,endpoint);        }        protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey sKey) throws IOException        {            return SelectChannelConnector.this.newEndPoint(channel,selectSet,sKey);        }    };        /* ------------------------------------------------------------------------------- */    /**     * Constructor.     *      */    public SelectChannelConnector()    {    }        /* ------------------------------------------------------------ */    public void accept(int acceptorID) throws IOException    {        _manager.doSelect(acceptorID);    }        /* ------------------------------------------------------------ */    public void close() throws IOException    {        synchronized(this)        {            if (_acceptChannel != null)                _acceptChannel.close();            _acceptChannel = null;        }    }        /* ------------------------------------------------------------------------------- */    public void customize(org.mortbay.io.EndPoint endpoint, Request request) throws IOException    {        ConnectorEndPoint cep = ((ConnectorEndPoint)endpoint);        cep.cancelIdle();        request.setTimeStamp(cep.getSelectSet().getNow());        super.customize(endpoint, request);    }        /* ------------------------------------------------------------------------------- */    public void persist(org.mortbay.io.EndPoint endpoint) throws IOException    {        ((ConnectorEndPoint)endpoint).scheduleIdle();        super.persist(endpoint);    }    /* ------------------------------------------------------------ */    public Object getConnection()    {        return _acceptChannel;    }        /* ------------------------------------------------------------ */    /** Get delay select key update     * If true, the select set is not updated when a endpoint is dispatched for     * reading. The assumption is that the task will be short and thus will probably     * be complete before the select is tried again.     * @return Returns the assumeShortDispatch.     */    public boolean getDelaySelectKeyUpdate()    {        return _manager.isDelaySelectKeyUpdate();    }    /* ------------------------------------------------------------------------------- */    public int getLocalPort()    {        synchronized(this)        {            if (_acceptChannel==null || !_acceptChannel.isOpen())                return -1;            return _acceptChannel.socket().getLocalPort();        }    }    /* ------------------------------------------------------------ */    /*     * @see org.mortbay.jetty.Connector#newContinuation()     */    public Continuation newContinuation()    {        return new RetryContinuation();    }    /* ------------------------------------------------------------ */    public void open() throws IOException    {        synchronized(this)        {            if (_acceptChannel == null)            {                // Create a new server socket                _acceptChannel = ServerSocketChannel.open();                // Bind the server socket to the local host and port                _acceptChannel.socket().setReuseAddress(getReuseAddress());                InetSocketAddress addr = getHost()==null?new InetSocketAddress(getPort()):new InetSocketAddress(getHost(),getPort());                _acceptChannel.socket().bind(addr,getAcceptQueueSize());                // Set to non blocking mode                _acceptChannel.configureBlocking(false);                            }        }    }    /* ------------------------------------------------------------ */    /**     * @param delay If true, updating a {@link SelectionKey} is delayed until a redundant event is      * schedules.  This is an optimization that assumes event handling can be completed before the next select     * completes.     */    public void setDelaySelectKeyUpdate(boolean delay)    {        _manager.setDelaySelectKeyUpdate(delay);    }    /* ------------------------------------------------------------ */    public void setMaxIdleTime(int maxIdleTime)    {        _manager.setMaxIdleTime(maxIdleTime);        super.setMaxIdleTime(maxIdleTime);    }    /* ------------------------------------------------------------ */    /**     * @return the lowResourcesConnections     */    public long getLowResourcesConnections()    {        return _lowResourcesConnections;    }    /* ------------------------------------------------------------ */    /**     * Set the number of connections, which if exceeded places this manager in low resources state.     * This is not an exact measure as the connection count is averaged over the select sets.     * @param lowResourcesConnections the number of connections     * @see {@link #setLowResourcesMaxIdleTime(long)}     */    public void setLowResourcesConnections(long lowResourcesConnections)    {        _lowResourcesConnections=lowResourcesConnections;    }    /* ------------------------------------------------------------ */    /**     * @return the lowResourcesMaxIdleTime     */    public long getLowResourcesMaxIdleTime()    {        return _lowResourcesMaxIdleTime;    }    /* ------------------------------------------------------------ */    /**     * Set the period in ms that a connection is allowed to be idle when this there are more     * than {@link #getLowResourcesConnections()} connections.  This allows the server to rapidly close idle connections     * in order to gracefully handle high load situations.     * @param lowResourcesMaxIdleTime the period in ms that a connection is allowed to be idle when resources are low.     * @see {@link #setMaxIdleTime(long)}     * @deprecated use {@link #setLowResourceMaxIdleTime(int)}     */    public void setLowResourcesMaxIdleTime(long lowResourcesMaxIdleTime)    {        _lowResourcesMaxIdleTime=lowResourcesMaxIdleTime;        super.setLowResourceMaxIdleTime((int)lowResourcesMaxIdleTime); // TODO fix the name duplications    }    /* ------------------------------------------------------------ */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产在线播放网站| 精品国产凹凸成av人网站| 五月天激情综合| 精品无人区卡一卡二卡三乱码免费卡| 国产午夜三级一区二区三| 欧美午夜精品久久久| 国产很黄免费观看久久| 天天影视色香欲综合网老头| 国产婷婷一区二区| 亚洲精品一区在线观看| 在线观看91精品国产入口| 成人久久视频在线观看| 国产精品嫩草久久久久| 国产欧美精品一区二区三区四区| 欧洲一区二区三区在线| 色婷婷精品大在线视频| 秋霞电影一区二区| 最好看的中文字幕久久| 亚洲一区二区三区美女| 久久99热这里只有精品| 成人精品国产免费网站| 在线视频一区二区三| 日韩一区二区免费电影| 国产精品视频你懂的| 亚洲国产精品久久人人爱| 久久99国产精品久久99果冻传媒| 丰满岳乱妇一区二区三区| 色天使色偷偷av一区二区| 欧美一区二区三区四区五区| 久久久久国产精品麻豆ai换脸| 亚洲精品免费在线观看| 久久精品国产精品亚洲精品 | 91亚洲永久精品| 欧美高清hd18日本| 亚洲国产成人一区二区三区| 亚洲午夜国产一区99re久久| 国产精品2024| 欧美日韩第一区日日骚| 中文字幕第一区二区| 丝袜亚洲精品中文字幕一区| 高清不卡在线观看| 在线成人高清不卡| 亚洲欧洲日韩女同| 国产在线不卡一卡二卡三卡四卡| 色综合天天性综合| 国产人成亚洲第一网站在线播放| 亚洲成av人片一区二区三区| 成人妖精视频yjsp地址| 日韩欧美在线不卡| 亚洲地区一二三色| 91蜜桃网址入口| 久久欧美一区二区| 日本伊人色综合网| 欧美一区二区视频观看视频| 亚洲欧美另类在线| 国产麻豆精品95视频| 欧美男人的天堂一二区| 一区二区三区在线视频观看| 懂色av一区二区在线播放| 日韩精品中文字幕在线不卡尤物| 亚洲第一二三四区| 欧美婷婷六月丁香综合色| 国产精品视频一区二区三区不卡| 麻豆精品一区二区综合av| 欧美日韩一区二区三区免费看| 国产精品国产成人国产三级| 国产乱码字幕精品高清av| 精品国产91亚洲一区二区三区婷婷| 天堂久久一区二区三区| 欧美色中文字幕| 亚洲成人激情自拍| 欧美日韩在线观看一区二区 | 91女人视频在线观看| 久久午夜羞羞影院免费观看| 麻豆精品一区二区三区| 日韩三级在线观看| 国产麻豆成人传媒免费观看| 久久日一线二线三线suv| 国产精品77777竹菊影视小说| 久久尤物电影视频在线观看| 国内成人自拍视频| 国产精品成人免费精品自在线观看| 成人免费黄色在线| 一区二区欧美精品| www精品美女久久久tv| 紧缚捆绑精品一区二区| 国产午夜精品久久| 色噜噜狠狠色综合中国| 亚洲午夜久久久久久久久电影院| 欧美日韩在线播放三区四区| 免费人成精品欧美精品| 国产亚洲福利社区一区| 99热这里都是精品| 亚洲国产日韩a在线播放性色| 欧美日韩国产区一| 精品午夜久久福利影院| 国产精品黄色在线观看| 欧美精品国产精品| 国产精品一区二区不卡| 一区二区三区**美女毛片| 欧美一区在线视频| 成人av电影在线| 亚洲成人免费视频| 国产亚洲美州欧州综合国| 色一情一乱一乱一91av| 奇米一区二区三区av| 国产精品灌醉下药二区| 555夜色666亚洲国产免| 国产电影精品久久禁18| 亚洲午夜激情网页| 国产视频一区二区在线观看| 欧美日韩视频第一区| 粉嫩嫩av羞羞动漫久久久| 日韩精品欧美精品| 亚洲精品伦理在线| 精品国产91九色蝌蚪| 在线观看亚洲成人| 国产成人精品一区二| 免费在线观看精品| 亚洲国产裸拍裸体视频在线观看乱了 | 不卡一区在线观看| 日韩高清一区在线| 亚洲欧美日韩在线不卡| 欧美一二三区在线观看| 91看片淫黄大片一级| 国产一区二区三区免费观看| 一区二区三区成人| 欧美—级在线免费片| 日韩一区和二区| 一本到高清视频免费精品| 轻轻草成人在线| 亚洲一区二区三区四区在线观看 | 91精品国产色综合久久不卡电影| 91片黄在线观看| 国产伦精品一区二区三区在线观看| 亚洲午夜一二三区视频| 亚洲欧美影音先锋| 欧美激情在线看| 国产日韩欧美精品一区| 欧美videossexotv100| 91 com成人网| 欧美精品久久天天躁| 国产高清精品网站| 日韩国产在线观看一区| 亚洲影视资源网| 91精品国产福利| 欧美剧情片在线观看| 99re这里都是精品| 不卡av免费在线观看| 久久99精品久久只有精品| 美国精品在线观看| 捆绑紧缚一区二区三区视频| 婷婷成人综合网| 日本在线不卡视频| 久久精品国产在热久久| 国产一区久久久| 国产大陆精品国产| 欧美亚一区二区| 欧美亚一区二区| 69成人精品免费视频| 欧美日韩亚洲综合| 日韩视频在线一区二区| 精品少妇一区二区三区在线播放| 精品日韩一区二区三区| 久久精品亚洲一区二区三区浴池| 国产欧美一区二区精品忘忧草| 国产午夜精品久久久久久久 | 色婷婷精品大视频在线蜜桃视频 | 久久精品国产亚洲高清剧情介绍 | 日韩欧美精品在线视频| 久久影院午夜论| 国产精品毛片大码女人| 亚洲国产中文字幕| 久久精品国产亚洲aⅴ| 国产成人av福利| 在线中文字幕一区二区| 欧美一区二区三区免费大片| 337p日本欧洲亚洲大胆精品| 国产网红主播福利一区二区| 一区二区三区在线观看欧美| 男男gaygay亚洲| 不卡电影免费在线播放一区| 欧美美女直播网站| 国产亚洲欧美中文| 亚洲成av人影院| 成人免费毛片a| 91精品蜜臀在线一区尤物| 亚洲国产精品精华液ab| 亚洲午夜三级在线| 国产.精品.日韩.另类.中文.在线.播放| 91碰在线视频| 久久久久国产免费免费| 亚洲成av人片一区二区三区| 国产精品影音先锋| 91精品国产一区二区三区香蕉| 国产喂奶挤奶一区二区三区| 天天综合天天综合色| 91香蕉视频污在线| 久久理论电影网| 奇米精品一区二区三区在线观看一|