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

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

?? listeningcontextpool.java

?? 無線網絡管理
?? JAVA
字號:
// NAME//      $RCSfile: ListeningContextPool.java,v $// DESCRIPTION//      [given below in javadoc format]// DELTA//      $Revision: 3.6 $// CREATED//      $Date: 2006/11/29 16:12:50 $// COPYRIGHT//      Westhawk Ltd// TO DO///* * Copyright (C) 2005 - 2006 by Westhawk Ltd * <a href="www.westhawk.co.uk">www.westhawk.co.uk</a> * * Permission to use, copy, modify, and distribute this software * for any purpose and without fee is hereby granted, provided * that the above copyright notices appear in all copies and that * both the copyright notice and this permission notice appear in * supporting documentation. * This software is provided "as is" without express or implied * warranty. * author <a href="mailto:snmp@westhawk.co.uk">Tim Panton</a> */package uk.co.westhawk.snmp.stack;import java.util.*;import uk.co.westhawk.snmp.event.*;/** * This class contains the pool of listening contexts. The usage of this * class will prevent more than one ListeningContext trying to listen to * the same port. * * @see ListeningContext * @since 4_14 * @author <a href="mailto:snmp@westhawk.co.uk">Birgit Arkesteijn</a> * @version $Revision: 3.6 $ $Date: 2006/11/29 16:12:50 $ */public class ListeningContextPool implements ListeningContextFace{    private static final String     version_id =        "@(#)$Id: ListeningContextPool.java,v 3.6 2006/11/29 16:12:50 birgit Exp $ Copyright Westhawk Ltd";    protected static Hashtable contextPool;    protected ListeningContext context = null;    protected String socketType;    protected String bindAddr;    protected int hostPort;/** * Constructor, using the Standard socket type. * * @param port The local port where packets are received * * @see #ListeningContextPool(int, String) * @see SnmpContextBasisFace#STANDARD_SOCKET */public ListeningContextPool(int port) {    this(port, null, SnmpContextBasisFace.STANDARD_SOCKET);}/** * Constructor, using the Standard socket type. * * If bindAddress is null, it will accept connections on * any/all local addresses. If you want to listen to * <ul> *    <li> *      IPv4 only interfaces, use address "0.0.0.0" *    </li> *    <li> *      IPv6 only interfaces, use address "::" *    </li> * </ul> * * @param port The local port where packets are received * @param bindAddress The local address the server will bind to  * * @see SnmpContextBasisFace#STANDARD_SOCKET */public ListeningContextPool(int port, String bindAddress) {    this(port, bindAddress, SnmpContextBasisFace.STANDARD_SOCKET);}/** * Constructor. * * If bindAddress is null, it will accept connections on * any/all local addresses. If you want to listen to * <ul> *    <li> *      IPv4 only interfaces, use address "0.0.0.0" *    </li> *    <li> *      IPv6 only interfaces, use address "::" *    </li> * </ul> * * The typeSocket will indicate which type of socket to use. This way * different handlers can be provided. * * <p> * Note, the TCP_SOCKET does not provide functionality to send a * response back. Listening on such a socket is only useful when * listening for traps. * </p> * * @param port The local port where packets are received * @param bindAddress The local address the server will bind to  * @param typeSocket The type of socket to use. * * @see SnmpContextBasisFace#STANDARD_SOCKET * @see SnmpContextBasisFace#TCP_SOCKET */public ListeningContextPool(int port, String bindAddress, String typeSocket) {    initPools();    hostPort = port;    bindAddr = bindAddress;    socketType = typeSocket;    context = getMatchingContext();}private static synchronized void initPools(){    if (contextPool == null)    {        contextPool = new Hashtable(5);    }}public int getPort(){    return hostPort;}public String getBindAddress(){    return bindAddr;}public String getTypeSocket(){    return socketType;}public int getMaxRecvSize(){    int res = SnmpContextBasisFace.MSS;    if (context != null)    {        res = context.getMaxRecvSize();    }    return res;}/** * Sets the maximum number of bytes this context will read from the * socket. By default this will be set to <code>MSS</code> (i.e. 1300). * Only the current context will be affected, <em>not</em> to all the  * contexts in the pool. * * @param no The new size  * * @see SnmpContextBasisFace#MSS * @see AbstractSnmpContext#getMaxRecvSize() */public void setMaxRecvSize(int no){    if (context == null)    {        context = getMatchingContext();    }    context.setMaxRecvSize(no);}/** * Destroys the current context.  * * <p> * Note that by calling this method the whole stack will stop listening * for packets on the port this context was listening on! The listeners  * added via the SnmpContext classes are affected as well. * </p> * * @see #destroyPool() * @see ListeningContextPool#destroy() */public void destroy(){    String hashKey = getHashKey();    synchronized(contextPool)    {        int count = 0;        Item item = (Item) contextPool.get(hashKey);        if (item != null)        {            count = item.getCounter();            count--;            item.setCounter(count);        }        if (count <=0)        {            contextPool.remove(hashKey);            if (context != null)            {                context.destroy();                context = null;            }        }    }}/** * Destroys all the contexts in the pool and empties the pool.  * * <p> * Note that by calling this method the whole stack will stop listening * for any packets! The listeners added via the  * SnmpContext classes are affected as well. * </p> * * @see #destroy() */public void destroyPool(){    Hashtable copyOfPool = null;    synchronized(contextPool)    {        synchronized(contextPool)        {            copyOfPool = (Hashtable) contextPool.clone();        }        contextPool.clear();    }    context = null;    Enumeration keys = copyOfPool.keys();    while (keys.hasMoreElements())    {        String key = (String) keys.nextElement();        Item item = (Item) copyOfPool.get(key);        if (item != null)        {            ListeningContext cntxt = (ListeningContext) item.getContext();            cntxt.destroy();        }    }    copyOfPool.clear();}/** * Returns a context from the pool.  * This methods checks for an existing context that matches all our * properties. If such a context does not exist, a new one is created and * added to the pool.  * * @return A context from the pool  * @see #getHashKey */protected ListeningContext getMatchingContext() {    Item item = null;    ListeningContext newContext = null;    String hashKey = getHashKey();    synchronized(contextPool)    {        int count=0;        if (contextPool.containsKey(hashKey))        {            item = (Item) contextPool.get(hashKey);            newContext = item.getContext();            count = item.getCounter();        }        else        {            newContext = new ListeningContext(hostPort, bindAddr, socketType);            item = new Item(newContext);            contextPool.put(hashKey, item);        }        count++;        item.setCounter(count);    }    return newContext;}/** * Dumps the pool of contexts. This is for debug purposes. * @param title The title of the dump */public void dumpContexts(String title){    Hashtable copyOfPool = null;    synchronized(contextPool)    {        copyOfPool = (Hashtable) contextPool.clone();    }    System.out.println(title + " " + copyOfPool.size());    Enumeration keys = copyOfPool.keys();    int i=0;    while (keys.hasMoreElements())    {        String key = (String) keys.nextElement();        Item item = (Item) copyOfPool.get(key);        if (item != null)        {            int count = item.getCounter();            ListeningContext cntxt = item.getContext();            System.out.println("\tcontext: " + key + ", count: " + count                + ", index: " + i + ", " + cntxt.toString());            if (cntxt == context)            {                System.out.println("\t\tcurrent context");            }            i++;        }    }}/** * Returns the hash key. This key is built out of all properties. It * serves as key for the pool of contexts. * * @return The hash key */public String getHashKey(){    String str = hostPort          + "_" + bindAddr          + "_" + socketType;    return str;}public void addRawPduListener(RawPduListener l) throws java.io.IOException{    if (context != null)    {        context.addRawPduListener(l);    }}public void removeRawPduListener(RawPduListener l) {    if (context != null)    {        context.removeRawPduListener(l);    }}/** * Removes the specified PDU listener from all the contexts in the pool.  * * @see ListeningContext#removeRawPduListener */public void removeRawPduListenerFromPool(RawPduListener l) {    Hashtable copyOfPool = null;    if (contextPool != null)    {        synchronized(contextPool)        {            copyOfPool = (Hashtable) contextPool.clone();        }        Enumeration keys = copyOfPool.keys();        while (keys.hasMoreElements())        {            String key = (String) keys.nextElement();            Item item = (Item) copyOfPool.get(key);            if (item != null)            {                ListeningContext cntxt = item.getContext();                cntxt.removeRawPduListener(l);            }        }    }}public void addUnhandledRawPduListener(RawPduListener l) throws java.io.IOException{    if (context != null)    {        context.addUnhandledRawPduListener(l);    }}public void removeUnhandledRawPduListener(RawPduListener l) {    if (context != null)    {        context.removeUnhandledRawPduListener(l);    }}/** * Returns a string representation of the object. * @return The string */public String toString(){    String res = "";    if (context != null)    {        res = context.toString();    }    return res;}class Item {    private ListeningContext context = null;    private int counter = 0;    /**     * Constructor.     *     * @param con The context     */    Item(ListeningContext con)    {        context = con;        counter = 0;    }    ListeningContext getContext()    {        return context;    }    int getCounter()    {        return counter;    }    void setCounter(int i)    {        counter = i;    }    /**     * Returns a string representation of the object.     * @return The string     */    public String toString()    {        StringBuffer buffer = new StringBuffer("Item[");        buffer.append("context=").append(context.toString());        buffer.append(", counter=").append(counter);        buffer.append("]");        return buffer.toString();    }} // end Item} // end ListeningContextPool

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
2023国产精华国产精品| 高清av一区二区| 91精品在线观看入口| 一区二区在线看| 欧美亚洲一区三区| 亚洲国产三级在线| 欧美日韩国产首页| 视频精品一区二区| 欧美哺乳videos| 成人网在线免费视频| 国产精品美女视频| 在线影院国内精品| 三级久久三级久久久| 欧美一级二级三级乱码| 久久精品国产精品亚洲红杏| 欧美白人最猛性xxxxx69交| 国产丶欧美丶日本不卡视频| 国产精品久久一卡二卡| 欧美色图天堂网| 七七婷婷婷婷精品国产| 国产精品天干天干在线综合| 99这里都是精品| 五月天激情综合| 中文字幕精品一区| 91久久精品一区二区三| 免费成人在线观看视频| 亚洲尤物在线视频观看| 欧美一区二区啪啪| 成人av电影在线观看| 视频一区二区三区入口| 国产欧美一区在线| 欧美中文一区二区三区| 九九热在线视频观看这里只有精品| 国产精品视频你懂的| 538在线一区二区精品国产| 成人高清视频在线| 日韩电影在线观看一区| 国产精品久久久久久久久免费樱桃| 在线这里只有精品| 国模冰冰炮一区二区| 亚洲1区2区3区4区| 中文字幕一区二区三区av| 欧美一级夜夜爽| 91婷婷韩国欧美一区二区| 韩国三级在线一区| 亚瑟在线精品视频| 中文字幕五月欧美| 欧美变态tickle挠乳网站| 欧美无砖专区一中文字| 暴力调教一区二区三区| 国产一区二区三区久久久| 五月婷婷激情综合网| 亚洲女同一区二区| 国产丝袜美腿一区二区三区| 日韩欧美国产午夜精品| 欧美视频中文字幕| 色综合天天做天天爱| 国产成人精品综合在线观看 | 中文字幕一区视频| 亚洲精品一区在线观看| 欧美日韩一区二区三区在线看| youjizz久久| 国产超碰在线一区| 国产一区二区伦理| 久久精品国产一区二区| 日韩av不卡一区二区| 亚洲成人7777| 亚洲午夜精品久久久久久久久| 亚洲精品成人悠悠色影视| 亚洲同性同志一二三专区| 国产精品女上位| 中文字幕 久热精品 视频在线| 久久久不卡网国产精品二区| 日韩手机在线导航| 精品日韩一区二区三区| 日韩欧美一级在线播放| 精品日产卡一卡二卡麻豆| 欧美sm极限捆绑bd| 欧美精品一区二区在线播放| 久久一夜天堂av一区二区三区| www激情久久| 国产亚洲欧美日韩俺去了| 国产亲近乱来精品视频| 亚洲一二三四在线观看| 亚洲综合丁香婷婷六月香| 一区二区三区欧美| 亚洲国产精品一区二区www| 一区二区三国产精华液| 亚洲成av人综合在线观看| 日本视频免费一区| 久久99在线观看| 国产成人av一区二区| 99re热视频精品| 欧美亚洲一区三区| 日韩三级电影网址| 国产三级精品视频| 亚洲图片激情小说| 丝袜美腿成人在线| 国产精品综合在线视频| av一二三不卡影片| 欧美三级一区二区| 日韩一区二区精品葵司在线| 久久久美女毛片| 亚洲欧美日韩国产一区二区三区| 一区二区三区久久久| 免费成人结看片| 福利视频网站一区二区三区| 在线亚洲免费视频| 欧美成人欧美edvon| 国产精品久久综合| 无吗不卡中文字幕| 国产乱码精品一区二区三区忘忧草 | 中文无字幕一区二区三区 | 风流少妇一区二区| 欧美一a一片一级一片| 久久综合色之久久综合| 一区二区三区在线视频观看58 | 亚洲高清一区二区三区| 精品一区二区三区视频| 一本色道**综合亚洲精品蜜桃冫| 欧美一级在线视频| 韩国av一区二区三区在线观看| 福利一区在线观看| 欧美电影在哪看比较好| 日本一区二区三区免费乱视频 | 亚洲女与黑人做爰| 国产一区二三区| 欧美色图天堂网| 国产精品污污网站在线观看| 五月天久久比比资源色| 99久久精品费精品国产一区二区| 欧美一级一级性生活免费录像| 成人免费在线视频观看| 麻豆国产欧美日韩综合精品二区| 99re视频这里只有精品| 久久久综合九色合综国产精品| 亚洲一区二区av在线| 成人免费毛片片v| 精品免费视频一区二区| 水蜜桃久久夜色精品一区的特点| 99这里只有精品| 中文字幕久久午夜不卡| 精品一区二区日韩| 6080日韩午夜伦伦午夜伦| 综合网在线视频| 成人免费视频免费观看| 久久婷婷色综合| 美女网站在线免费欧美精品| 欧美色中文字幕| 一区二区三区在线免费视频| 北岛玲一区二区三区四区| 国产亚洲美州欧州综合国| 韩国一区二区在线观看| 欧美mv日韩mv国产网站| 丝袜脚交一区二区| 7777女厕盗摄久久久| 午夜欧美在线一二页| 色哟哟在线观看一区二区三区| 欧美激情一区二区在线| 国产成人亚洲综合色影视| 久久综合色8888| 美国十次了思思久久精品导航| 欧美精品久久天天躁| 五月婷婷激情综合| 欧美区一区二区三区| 亚洲成人av免费| 欧美在线free| 天天操天天干天天综合网| 欧美日韩亚洲不卡| 日本视频一区二区三区| 欧美不卡一区二区| 国内精品国产三级国产a久久| 精品久久久网站| 91国产福利在线| 亚洲图片自拍偷拍| 欧美精品视频www在线观看| 天堂久久久久va久久久久| 欧美精品丝袜中出| 麻豆国产一区二区| 久久嫩草精品久久久久| 成人动漫视频在线| 亚洲日本青草视频在线怡红院| 91豆麻精品91久久久久久| 亚洲国产精品天堂| 欧美mv日韩mv亚洲| 成人黄色一级视频| 一区二区在线免费| 日韩一区二区精品在线观看| 国产精品一级在线| 日韩美女视频19| 欧美女孩性生活视频| 精品影院一区二区久久久| 国产日韩av一区| 91久久精品网| 精品一区二区三区不卡| 中文字幕在线观看一区二区| 欧美特级限制片免费在线观看| 美国毛片一区二区三区| 中文字幕av一区二区三区高| 精品视频一区二区三区免费|