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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? outgoingconnectionmanager.java

?? P2P協(xié)議GUNTELLA的java源代碼
?? JAVA
字號:
/* * Copyright (C) 2000-2001  Ken McCrary * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * * Email: jkmccrary@yahoo.com */package com.kenmccrary.jtella;import java.io.IOException;import java.util.List;import java.util.LinkedList;import java.util.Collections;import com.kenmccrary.jtella.util.Log;/** *  Manages the outgoing connections, attempts to connect *  to the network agressively. Initiates more than required *  connections in an attempt to quickly achieve connections *   */class OutgoingConnectionManager extends ConnectionManager{  private HostCache hostCache;  private StarterPool starterPool;     /**    *  Constructs the outgoing connection manager    *    */   OutgoingConnectionManager(Router router,                             HostCache hostCache,                             ConnectionList connectionList,                             ConnectionData connectionData) throws IOException  {     super(router, connectionList, connectionData);     this.hostCache = hostCache;     starterPool = new StarterPool(connectionData);  }       /**    *  Main processing loop    *    */   public void run()   {     while ( !isShutdown() )       {           try       {         Thread.currentThread().sleep(1000);       }       catch(InterruptedException e)       {         // ignore         continue;         }       // clean dead connections       int liveCount = connectionList.cleanDeadConnections                                    (NodeConnection.CONNECTION_OUTGOING);       // precondition, need hosts       if ( hostCache.size() == 0 )        {         Log.getLog().logDebug("no hosts cached");         continue;       }              // count number of active connections       int activeCount = connectionList.getActiveOutgoingConnectionCount();              // attempt connections on more servants than necessary to       // accelerate achieving desired connections       if ( activeCount == connectionData.getOutgoingConnectionCount() )       {             // connection requests satisfied           Log.getLog().logInformation(activeCount + " connections achieved");           connectionList.stopOutgoingConnectionAttempts();         continue;         }           else if( activeCount > connectionData.getOutgoingConnectionCount() )       {             // connection requests satisfied           Log.getLog().logInformation("Reducing outgoing connections to: " +                                      connectionData.getOutgoingConnectionCount() );           connectionList.stopOutgoingConnectionAttempts();         connectionList.reduceActiveOutgoingConnections                                      (connectionData.getOutgoingConnectionCount());         continue;              }           else if( (liveCount - activeCount) <              ( (connectionData.getOutgoingConnectionCount() - activeCount) * 2) )       {              Host host = hostCache.nextHost();          Log.getLog().logInformation(liveCount +                                      " live connections " +                                      connectionData.getOutgoingConnectionCount() +                                      " requested");                    Log.getLog().logInformation("Connection control attempting a connection: " +                                       host.getIPAddress() +                                       ":" +                                       host.getPort());                    if ( connectionList.contains(host.getIPAddress()) )          {            // avoid duplicate connection              Log.getLog().logInformation("Aborting start on duplicate host: " +                                         host.toString());              continue;          }                    ConnectionStarter starter = starterPool.getStarter();          starter.setHost(host);        }       }   }          /**    *  Attempts to add an immediate connection, opening a slot if needed    *    *  @param ipAddress host IP address    *  @param port port number    */    void addImmediateConnection(String ipAddress, int port)    {      int activeCount = connectionList.getActiveOutgoingConnectionCount();      if ( activeCount == connectionData.getOutgoingConnectionCount() )      {             connectionList.reduceActiveOutgoingConnections                                      (connectionData.getOutgoingConnectionCount());      }            Host host = new Host(ipAddress, port, 0, 0);      ConnectionStarter starter = starterPool.getStarter();      starter.setHost(host);   }   /**    *  Asynchronously attempts to start a connection    *    */    class ConnectionStarter extends Thread   {     private Host host;     private ConnectionData connectionData;     private StarterPool starterPool;     private boolean shutdown;          ConnectionStarter(StarterPool starterPool, ConnectionData connectionData)     {       super("ConnectionStarter");       this.connectionData = connectionData;       this.starterPool = starterPool;     }              void shutdown()     {       shutdown = true;       interrupt();     }          /**      *  Set the host for this connection starter to work on      *      *  @param host host to work on      */     void setHost(Host host)     {       this.host = host;       hostCache.removeHost(host); //todo rethink this       synchronized(this)       {         notify();       }       }          /**      *  Run the starter      */     public void run()     {       while ( !shutdown )       {           while ( null == host )          {           synchronized (this)           {             try             {              wait();             }             catch (InterruptedException e)             {               break;             }           }         }                    if ( !shutdown && null != host )         {            try          {            NodeConnection connection = new NodeConnection(router,                                                             host.getIPAddress(),                                                             host.getPort(),                                                            connectionData);              connectionList.addConnection(connection);            connection.startOutgoingConnection();            host = null;            starterPool.putStarter(this);          }          catch (Exception e)          {             Log.getLog().log(e);            }         }         }       }       }          /**    *  Pool of connection starters    *    */   class StarterPool   {      private List starterList;      private ConnectionData connectionData;            /**       *  Construct the starter pool and populate it       *       */      StarterPool(ConnectionData connectionData)      {        starterList = new LinkedList();        this.connectionData = connectionData;                for (int i = 0;              i < (connectionData.getOutgoingConnectionCount() * 2);             i++)        {          ConnectionStarter starter = new ConnectionStarter(this,                                                             connectionData);          starter.start();          starterList.add(starter);        }        }            /**       *  Get a starter thread       *        *  @return starter thread       */      synchronized ConnectionStarter getStarter()      {        if ( starterList.size() == 0 )        {          ConnectionStarter starter = new ConnectionStarter(this,                                                            connectionData);          starter.start();          return starter;        }                return (ConnectionStarter)starterList.remove(0);      }            /**       *  Put a starter back into the pool       *       *  @param connectionStarter connection starter       */      synchronized void putStarter(ConnectionStarter connectionStarter)      {        if ( starterList.size() >              (connectionData.getOutgoingConnectionCount() * 2) )        {          // not needed          connectionStarter.shutdown();          return;        }                starterList.add(connectionStarter);      }   }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美激情一区二区三区全黄 | 欧美日韩国产大片| 久久91精品国产91久久小草| 中文字幕一区二区三区不卡| 欧美一区二区三区免费视频| 99r国产精品| 国产一区二三区| 偷拍日韩校园综合在线| 国产日韩影视精品| 日韩三级在线免费观看| 日本高清视频一区二区| 国产一区二区中文字幕| 天天综合天天综合色| 综合欧美一区二区三区| 国产亚洲欧美日韩在线一区| 91精品国产91久久久久久一区二区 | 欧美性大战久久久久久久蜜臀| 国产一区二区网址| 免费欧美高清视频| 亚洲成av人片| 亚洲国产一二三| 亚洲欧洲中文日韩久久av乱码| 中文字幕欧美激情一区| 精品盗摄一区二区三区| 欧美一区二区视频观看视频| 欧日韩精品视频| 91老师片黄在线观看| 国产高清不卡一区二区| 久久av资源网| 国产综合一区二区| 精品在线免费视频| 久久er精品视频| 久久99精品国产.久久久久久 | 中文字幕日韩精品一区| 久久久国产一区二区三区四区小说| 日韩欧美中文字幕精品| 欧美一级夜夜爽| 欧美一区二区福利视频| 日韩欧美不卡在线观看视频| 欧美一区二区三区四区高清| 7777精品伊人久久久大香线蕉的 | 色综合久久天天| 色婷婷综合久色| 在线欧美小视频| 欧美影视一区在线| 欧美日韩一卡二卡| 在线播放欧美女士性生活| 欧美久久久久免费| 欧美一级欧美三级| 26uuu色噜噜精品一区二区| 久久久午夜精品| 国产精品久线在线观看| 综合色天天鬼久久鬼色| 亚洲与欧洲av电影| 日韩成人av影视| 精品一区二区三区的国产在线播放| 久久99精品久久久久久| 国产精品18久久久久| 不卡av电影在线播放| 色综合久久88色综合天天免费| 欧美羞羞免费网站| 在线播放91灌醉迷j高跟美女| 日韩精品一区在线观看| 中文一区二区在线观看| 一区二区三区四区不卡在线| 五月开心婷婷久久| 国产成人免费视频精品含羞草妖精| 不卡一区二区三区四区| 欧美专区日韩专区| 精品福利一区二区三区 | 奇米影视在线99精品| 狠狠色综合播放一区二区| 成人网页在线观看| 色婷婷综合久久久中文字幕| 91精品午夜视频| 日本一区二区免费在线| 夜夜夜精品看看| 国产一区二区主播在线| 在线观看免费亚洲| 亚洲精品一区二区三区四区高清| 国产精品国产三级国产普通话蜜臀 | 久久综合九色综合97婷婷| 欧美韩国日本一区| 视频一区欧美日韩| 大美女一区二区三区| 欧美日韩国产不卡| 中文字幕高清不卡| 青娱乐精品视频| 99这里只有久久精品视频| 91精品国产色综合久久| 国产精品久久久久久久第一福利 | 亚洲精品亚洲人成人网| 另类专区欧美蜜桃臀第一页| 色狠狠一区二区| 久久综合久久久久88| 亚洲一二三四区| 高清不卡在线观看| 欧美日韩不卡视频| 国产精品超碰97尤物18| 久久aⅴ国产欧美74aaa| 一本大道综合伊人精品热热| 精品国产不卡一区二区三区| 亚洲国产cao| www.亚洲色图.com| 精品av久久707| 天天操天天色综合| 99视频超级精品| 国产欧美日韩一区二区三区在线观看| 丝袜脚交一区二区| 色噜噜狠狠色综合中国| 日本一区二区三级电影在线观看| 久久成人精品无人区| 欧美三片在线视频观看 | 亚洲国产精品久久久久婷婷884| 国产精品66部| 欧美成人bangbros| 视频在线观看91| 欧美日韩一区三区| 樱桃视频在线观看一区| 成人午夜短视频| 欧美韩国日本综合| 极品少妇xxxx精品少妇偷拍| 欧美一区二区视频在线观看2020| 亚洲一区二区在线观看视频 | 国产日本欧美一区二区| 精品在线你懂的| 欧美成人精品1314www| 日本中文字幕一区| 欧美日韩精品电影| 亚洲成a人片在线观看中文| 91福利在线导航| 亚洲午夜精品在线| 欧美日韩国产综合一区二区 | 久久99在线观看| 精品免费99久久| 老色鬼精品视频在线观看播放| 在线播放91灌醉迷j高跟美女| 午夜一区二区三区视频| 欧美人牲a欧美精品| 天堂精品中文字幕在线| 在线不卡中文字幕播放| 老司机精品视频导航| 久久婷婷久久一区二区三区| 国产激情视频一区二区在线观看 | 亚洲电影中文字幕在线观看| 欧美在线不卡一区| 亚洲福利国产精品| 欧美伦理视频网站| 黄页视频在线91| 国产精品美女久久久久久| 播五月开心婷婷综合| 一区二区久久久| 91精品国产综合久久福利软件| 免费的成人av| 久久精品一区二区| 成人激情免费视频| 夜夜嗨av一区二区三区四季av| 欧美伊人精品成人久久综合97| 午夜欧美在线一二页| 欧美一级高清大全免费观看| 黑人巨大精品欧美黑白配亚洲| 久久久另类综合| 91日韩精品一区| 天堂av在线一区| 国产香蕉久久精品综合网| 91在线免费播放| 日韩电影在线观看网站| 国产亚洲综合在线| 色综合一个色综合亚洲| 五月婷婷久久丁香| 久久精品网站免费观看| av亚洲精华国产精华精| 亚洲成人精品影院| 精品精品欲导航| 99在线视频精品| 日韩高清在线一区| 日本一区二区三区四区在线视频| 欧美自拍偷拍一区| 极品尤物av久久免费看| 亚洲男同性视频| 欧美sm美女调教| 在线亚洲人成电影网站色www| 青青草国产成人av片免费| 国产精品免费丝袜| 51午夜精品国产| 不卡av在线免费观看| 日本视频在线一区| 国产精品理论片在线观看| 91麻豆精品国产综合久久久久久| 国产成人免费在线观看| 亚洲国产成人av网| 国产精品青草久久| 欧美一区二区三区影视| 99久久久免费精品国产一区二区| 日日噜噜夜夜狠狠视频欧美人| 国产精品久久久久久久岛一牛影视| 欧美精选一区二区| 99精品久久只有精品| 国产一区二区免费看| 香蕉乱码成人久久天堂爱免费|