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

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

?? connectionlist.java

?? P2P協(xié)議GUNTELLA的java源代碼
?? JAVA
字號(hào):
/* * 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.util.List;import java.util.LinkedList;import java.util.Collections;import java.util.Iterator;import com.kenmccrary.jtella.util.Log;/** *  Contains the set of current connections, the node connections *  can be in different states, not all may be active * */public class ConnectionList{  private List currentConnectionList;    ConnectionList()  {     currentConnectionList = Collections.synchronizedList(new LinkedList());  }        /**   *  Gets a list containing the connections   *   *  @return list of connections   */  public LinkedList getList()  {    return(new LinkedList(currentConnectionList));  }        /**   *  Adds a connection   *   *  @param connection new connection   */  void addConnection(NodeConnection connection)  {    synchronized(currentConnectionList)    {      currentConnectionList.add(connection);      }    }        /**   *  Removes a connection   *   *  @param connection to remove   */  void removeConnection(NodeConnection connection)  {    synchronized(currentConnectionList)    {      currentConnectionList.remove(connection);    }    }        /**   *  Check if a connection exists to a host   *   *  @param ipAddress host address   *  @return true if a connection exists to this IP address   */  boolean contains(String ipAddress)  {    boolean result = false;    synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while (i.hasNext() )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getConnectedServant().equals(ipAddress) )          {                return true;            }            }         }             return result;  }      /**   *  Get active outgoing and incoming connections   *   *  @return active connections   */  List getActiveConnections()  {    List all = getActiveOutgoingConnections();        all.addAll(getActiveIncomingConnections());        return all;  }    /**   *  Gets the active outgoing connections   *   *  @return list of connections   */  List getActiveOutgoingConnections()  {    return getActiveConnections(NodeConnection.CONNECTION_OUTGOING);    }        /**   *  Gets the active incoming connections   *   *  @return active list   */  List getActiveIncomingConnections()  {    return getActiveConnections(NodeConnection.CONNECTION_INCOMING);    }        /**   *  Gets the active outgoing connections   *   *  @return list of connections   */  private List getActiveConnections(int type)  {    LinkedList activeList = new LinkedList();        synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while ( i.hasNext() )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getType() == type &&               connection.getStatus() == NodeConnection.STATUS_OK)          {                activeList.add(connection);          }        }         }              return activeList;  }        /**   *  Gets a count of the active (running outgoing connections)   *   *  @return count   */  int getActiveOutgoingConnectionCount()  {    return getActiveConnectionCount(NodeConnection.CONNECTION_OUTGOING);    }     /**  *  Get the count of active incoming connections  *  *  @return count  */  int getActiveIncomingConnectionCount()  {    return getActiveConnectionCount(NodeConnection.CONNECTION_INCOMING);  }        /**   *  Gets a count of the active (running outgoing connections)   *   *  @return count   */  int getActiveConnectionCount(int type)  {    int activeCount = 0;        synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while ( i.hasNext() )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getType() == type &&               connection.getStatus() == NodeConnection.STATUS_OK)          {                activeCount++;          }        }         }              return activeCount;  }        /**   *  Reduce the number of outgoing connections   *   */  void reduceActiveOutgoingConnections(int newCount)  {    int activeCount = getActiveOutgoingConnectionCount();        if ( activeCount <= newCount )      {          // nothing to do      return;      }            int killCount = activeCount - newCount;    int killed = 0;    synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while ( i.hasNext() && killed != killCount )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getType() == NodeConnection.CONNECTION_OUTGOING &&               connection.getStatus() == NodeConnection.STATUS_OK)          {                connection.shutdown();            killed++;          }        }         }      }        /**   *  Reduce the number of incoming connections   *   */  void reduceActiveIncomingConnections(int newCount)  {    int activeCount = getActiveIncomingConnectionCount();        if ( activeCount <= newCount )      {          // nothing to do      return;      }            int killCount = activeCount - newCount;    int killed = 0;    synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while ( i.hasNext() && killed != killCount )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getType() == NodeConnection.CONNECTION_INCOMING &&               connection.getStatus() == NodeConnection.STATUS_OK)          {                connection.shutdown();            killed++;          }        }         }      }      /**   *  Remove any dead connections from the list   *   *  @param type of collection to clean   *  @return number of live connections remaining   */  int cleanDeadConnections(int type)  {    int liveCount = 0;    Log.getLog().logInformation("Live connection list start: ");        synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while (i.hasNext() )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getType() == type )          {                if ( connection.getStatus() != NodeConnection.STATUS_FAILED &&                 connection.getStatus() != NodeConnection.STATUS_STOPPED )            {                  liveCount++;                Log.getLog().logInformation("Live connection: " +                                          connection.getHost());            }                else            {                  i.remove();              }              }        }         }             Log.getLog().logInformation("Live connection list end");     return liveCount;  }    /**   *  Shuts down non-running connections   *   */  void stopOutgoingConnectionAttempts()  {    synchronized ( currentConnectionList )      {        Iterator i = currentConnectionList.iterator();                while (i.hasNext() )        {              NodeConnection connection = (NodeConnection)i.next();                    if ( connection.getType() == NodeConnection.CONNECTION_OUTGOING )          {                if ( connection.getStatus() == NodeConnection.STATUS_CONNECTING )            {                  connection.shutdown();              i.remove();            }              }        }         }      }        /**   *  Closes all connections and removes them from the collection   *   */  void empty()  {     synchronized ( currentConnectionList )      {      Iterator i = currentConnectionList.iterator();              while (i.hasNext() )      {            NodeConnection connection = (NodeConnection)i.next();                  connection.shutdown();        i.remove();        }    }      }    }    

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩不卡一二三区| 国产真实精品久久二三区| 欧美一区二区美女| 成人深夜在线观看| 日韩高清不卡在线| 亚洲日本va在线观看| 精品久久一二三区| 欧美写真视频网站| 成人av在线播放网址| 久久成人免费电影| 午夜欧美电影在线观看| 亚洲欧洲精品天堂一级| 欧美大片一区二区三区| 91国偷自产一区二区三区成为亚洲经典| 麻豆国产精品官网| 亚洲第一主播视频| 亚洲视频小说图片| 日本一区二区三区视频视频| 欧美一级黄色录像| 欧美婷婷六月丁香综合色| www.综合网.com| 国产精品自拍三区| 亚洲第一精品在线| 一区二区三区四区在线播放| 国产精品国产三级国产普通话99| 日韩欧美一级二级三级| 欧美精品在线视频| 欧美日韩久久一区| 欧美在线一区二区| 在线观看欧美日本| 91国偷自产一区二区三区观看| 99视频一区二区三区| 成人一区二区三区中文字幕| 国产在线麻豆精品观看| 久久爱另类一区二区小说| 日韩电影一区二区三区| 亚洲成人一区二区在线观看| 一区二区三区蜜桃网| 亚洲欧美另类在线| 亚洲乱码国产乱码精品精可以看| 中文字幕一区在线| 自拍av一区二区三区| 综合色中文字幕| 亚洲三级在线播放| 亚洲精品中文在线| 亚洲中国最大av网站| 亚洲第一激情av| 日韩电影一区二区三区四区| 日本中文字幕一区二区有限公司| 亚洲h在线观看| 日韩成人免费在线| 免费xxxx性欧美18vr| 蜜桃久久久久久| 精彩视频一区二区| 国产一区欧美一区| 国产成人精品亚洲日本在线桃色| 国产在线一区观看| 成人黄色a**站在线观看| 99视频在线观看一区三区| 一本色道久久综合精品竹菊| 欧美日韩电影在线播放| 欧美日韩国产另类不卡| 欧美一区二区三区喷汁尤物| 欧美成人一级视频| 国产女人18水真多18精品一级做| 中文字幕亚洲在| 一区二区成人在线观看| 日韩二区在线观看| 国产一区二区91| 99精品视频在线观看| 欧美午夜精品一区二区三区 | 岛国精品在线播放| 91丨porny丨户外露出| 欧美系列在线观看| 精品久久久三级丝袜| 中文字幕巨乱亚洲| 亚洲18色成人| 国产成人精品综合在线观看 | 国产亚洲一区二区三区| 国产精品久久久久久久久免费相片| 亚洲综合一二三区| 久久国产日韩欧美精品| 成人免费毛片嘿嘿连载视频| 欧美日韩大陆一区二区| 国产亚洲精品超碰| 亚洲综合在线电影| 九色综合狠狠综合久久| 91在线观看美女| 日韩一级黄色片| 亚洲三级免费观看| 精品一区二区三区香蕉蜜桃| 91视视频在线观看入口直接观看www | 精品三级在线观看| 中国av一区二区三区| 午夜亚洲福利老司机| 成人永久免费视频| 欧美一级二级三级乱码| 1区2区3区国产精品| 亚洲高清在线精品| 国产不卡高清在线观看视频| 欧美日韩aaaaa| 国产精品情趣视频| 欧美aaa在线| 色哟哟欧美精品| 久久久国产综合精品女国产盗摄| 亚洲综合一区二区三区| 成熟亚洲日本毛茸茸凸凹| 91精品在线一区二区| 玉足女爽爽91| 丰满放荡岳乱妇91ww| 欧美一区二区三区公司| 一区二区三区成人在线视频| 国产不卡视频在线观看| 日韩美女视频在线| 性欧美大战久久久久久久久| av电影一区二区| 国产色91在线| 久久电影网电视剧免费观看| 欧美老肥妇做.爰bbww视频| 亚洲女同女同女同女同女同69| 国产馆精品极品| 精品欧美久久久| 免费亚洲电影在线| 欧美日韩在线播放三区| 亚洲精品水蜜桃| 成人app在线观看| 中文字幕精品一区二区精品绿巨人 | 国产成人综合网| 日韩欧美aaaaaa| 日本麻豆一区二区三区视频| 欧美综合亚洲图片综合区| 最近中文字幕一区二区三区| 成人国产在线观看| 国产欧美精品国产国产专区| 国产乱码字幕精品高清av| 精品久久国产97色综合| 免费高清视频精品| 国产香蕉久久精品综合网| 久久99久久99小草精品免视看| 日韩一区二区三区在线视频| 奇米精品一区二区三区在线观看一| 欧美视频在线观看一区二区| 亚洲韩国精品一区| 欧美性色欧美a在线播放| 夜夜亚洲天天久久| 日本精品一区二区三区四区的功能| 中文字幕一区二区三区不卡在线| 成人免费视频网站在线观看| 国产精品福利av| 色婷婷综合中文久久一本| 亚洲精品精品亚洲| 在线观看国产一区二区| 偷拍日韩校园综合在线| 日韩一区二区三区在线视频| 国产一区二区在线免费观看| 国产欧美日韩综合| 不卡的电影网站| 一区二区三区久久| 欧美日本一区二区| 国内精品写真在线观看| 国产喷白浆一区二区三区| 99麻豆久久久国产精品免费| 亚洲免费观看高清| 8x福利精品第一导航| 国精品**一区二区三区在线蜜桃| 久久久久9999亚洲精品| av在线不卡免费看| 午夜欧美大尺度福利影院在线看| 欧美va在线播放| 成人性生交大合| 亚洲一区二区视频| 日韩欧美一级在线播放| 成人h精品动漫一区二区三区| 一区二区三区欧美日| 日韩美女一区二区三区四区| 成人av资源网站| 日韩国产高清在线| 国产精品视频九色porn| 欧美午夜电影一区| 韩国v欧美v日本v亚洲v| 亚洲视频免费在线| 欧美日韩精品系列| 高清在线不卡av| 午夜精彩视频在线观看不卡| www久久精品| 一本大道av伊人久久综合| 老鸭窝一区二区久久精品| 国产精品久久久久影院老司| 91精品中文字幕一区二区三区| 成人综合在线网站| 图片区小说区区亚洲影院| 日本一区二区在线不卡| 欧美久久久久久久久| 99久久精品免费| 六月丁香综合在线视频| 一区二区三区免费| 中文字幕欧美三区| 日韩欧美视频一区| 欧美日韩三级一区二区| 成人午夜看片网址|