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

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

?? spider.java~

?? < 網絡機器人java編程指南>>的配套源程序
?? JAVA~
字號:
/** * The Spider class is the main organizational class for * spidering.  It delegates work to the SpiderWorker class. * * Copyright 2001 by Jeff Heaton * * @author Jeff Heaton * @version 1.0 */package com.heaton.bot;import java.util.*;import java.io.*;import com.heaton.bot.*;public class Spider extends Thread implements ISpiderReportable {  protected IWorkloadStorable workload;  protected SpiderWorker pool[];  protected boolean worldSpider;  protected ISpiderReportable manager;  protected boolean halted = false;  protected SpiderDone done = new SpiderDone();  protected int maxBodySize;  /**   * This constructor prepares the spider to begin.   * Basic information required to begin is passed.   * This constructor uses the internal workload manager.   *   * @param manager The object that this spider reports its findings to.   * @param url The URL that the spider should begin at.   * @param http The HTTP handler used by this spider.   * @param poolsize The size of the thread pool.   */  public Spider(ISpiderReportable manager,String url,HTTP http,int poolSize)  {    this(manager,url,http,poolSize,new SpiderInternalWorkload());  }  /**   * This constructor prepares the spider to begin.   * Basic information required to begin is passed.   * This constructor allows the user to specify a   * customized workload manager.   *   * @param manager The object that this spider reports its findings to.   * @param url The URL that the spider should begin at.   * @param http The HTTP handler used by this spider.   * @param poolsize The size of the thread pool.   * @param w A customized workload manager.   */  public Spider(ISpiderReportable manager,String url,HTTP http,int poolSize,IWorkloadStorable w)  {    this.manager = manager;    worldSpider = false;    pool = new SpiderWorker[poolSize];    for ( int i=0;i<pool.length;i++ ) {      HTTP hc = http.copy();      pool[i] = new SpiderWorker( this,hc );    }    workload = w;    if ( url.length()>0 ) {      workload.clear();      addWorkload(url);    }  }  /**   * Get the SpiderDone object used by this spider   * to determine when it is done.   *   * @return Returns true if the spider is done.   */  public SpiderDone getSpiderDone()  {    return done;  }  /**   * The main loop of the spider. This can be called   * directly, or the start method can be called to   * run as a background thread. This method will not   * return until there is no work remaining for the   * spider.   */  public void run()  {    if ( halted )      return;    for ( int i=0;i<pool.length;i++ )      pool[i].start();    try {      done.waitBegin();      done.waitDone();      Log.log(Log.LOG_LEVEL_NORMAL,"Spider has no work.");      spiderComplete();      for ( int i=0;i<pool.length;i++ ) {        pool[i].interrupt();        pool[i].join();        pool[i] = null;      }    } catch ( Exception e ) {      Log.logException("Exception while starting spider", e);    }  }  /**   * This method is called to get a workload   * from the workload manager. If no workload   * is available, this method will block until   * there is one.   *   * @return Returns the next URL to be spidered.   */  synchronized public String getWorkload()  {    try {      for ( ;; ) {        if ( halted )          return null;        String w = workload.assignWorkload();        if ( w!=null )          return w;        wait();      }    } catch ( java.lang.InterruptedException e ) {    }    return null;  }  /**   * Called to add a workload to the workload manager.   * This method will release a thread that was waiting   * for a workload. This method will do nothing if the   * spider has been halted.   *   * @param url The URL to be added to the workload.   */  synchronized public void addWorkload(String url)  {    if ( halted )      return;    workload.addWorkload(url);    notify();  }  /**   * Called to specify this spider as either a world   * or site spider. See getWorldSpider for more information   * about what a world spider is.   *   * @param b True to be a world spider.   */  public void setWorldSpider(boolean b)  {    worldSpider = b;  }  /**   * Returns true if this is a world spider, a world   * spider does not restrict itself to a single site   * and will likely go on "forever".   *   * @return Returns true if the spider is done.   */  public boolean getWorldSpider()  {    return worldSpider;  }  /**   * Called when the spider finds an internal   * link. An internal link shares the same   * host address as the URL that started   * the spider. This method hands the link off   * to the manager and adds the URL to the workload   * if necessary.   *   * @param url The URL that was found by the spider.   * @return true - The spider should add this URL to the workload.   * false - The spider should not add this URL to the workload.   */  synchronized public boolean foundInternalLink(String url)  {    if ( manager.foundInternalLink(url) )      addWorkload(url);    return true;  }  /**   * Called when the spider finds an external   * link. An external link does not share the   * same host address as the URL that started   * the spider. This method hands the link off   * to the manager and adds the URL to the workload   * if necessary. If this is a world spider, then   * external links are treated as internal links.   *   * @param url The URL that was found by the spider.   * @return true - The spider should add this URL to the workload.   * false - The spider should not add this URL to the workload.   */  synchronized public boolean foundExternalLink(String url)  {    if ( worldSpider ) {      foundInternalLink(url);      return true;    }    if ( manager.foundExternalLink(url) )      addWorkload(url);    return true;  }  /**   * Called when the spider finds a type of   * link that does not point to another HTML   * page(for example a mailto link). This method   * hands the link off to the manager and adds   * the URL to the workload if necessary.   *   * @param url The URL that was found by the spider.   * @return true - The spider should add this URL to the workload.   * false - The spider should not add this URL to the workload.   */  synchronized public boolean foundOtherLink(String url)  {    if ( manager.foundOtherLink(url) )      addWorkload(url);    return true;  }  /**   * Called to actually process a page. This is where the   * work actually done by the spider is usually preformed.   *   * @param page The page contents.   * @param error true - This page resulted in an HTTP error.   * false - This page downloaded correctly.   */  synchronized public void processPage(HTTP page)  {    manager.processPage(page);  }  /**   * This method is called by the spider to determine if   * query strings should be removed. By default the spider   * always chooses to remove query strings, so true is   * returned.   *   * @return true - Query string should be removed.   * false - Leave query strings as is.   */  synchronized public boolean getRemoveQuery()  {    return true;  }  /**   * Called to request that a page be processed.   * This page was just downloaded by the spider.   * This messages passes this call on to its   * manager.   *   * @param page The page contents.   * @param error true - This page resulted in an HTTP error.   * false - This page downloaded correctly.   */  synchronized public void completePage(HTTP page,boolean error)  {    if( page.getURL().equals(page.getRootURL()) )    {        workload.completeWorkload(page.getURL(),error);    }    else    {        workload.completeWorkload(page.getRootURL(),error);        workload.addWorkload(page.getURL());        workload.completeWorkload(page.getURL(),error);    }  }  /**   * Called when the spider has no more work. This method   * just passes this event on to its manager.   */  synchronized public void spiderComplete()  {    manager.spiderComplete();  }  /**   * Called to cause the spider to halt. The spider will not halt   * immediately. Once the spider is halted the run method will   * return.   */  synchronized public void halt()  {    halted = true;    workload.clear();    notifyAll();  }  /**   * Determines if the spider has been halted.   *   * @return Returns true if the spider has been halted.   */  public boolean isHalted()  {    return halted;  }  /**   * This method will set the maximum body size   * that will be downloaded.   *   * @param i The maximum body size, or -1 for unlifted.   */  public void setMaxBody(int mx)  {    maxBodySize = mx;    for ( int i=0;i<pool.length;i++ )      pool[i].getHTTP().setMaxBody(mx);  }  /**   * This method will return the maximum body size   * that will be downloaded.   *   * @return The maximum body size, or -1 for unlifted.   */  public int getMaxBody()  {    return maxBodySize;  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区成人6969| 亚洲综合丁香婷婷六月香| 久久天堂av综合合色蜜桃网| 精品国产百合女同互慰| 国产日韩欧美一区二区三区综合| 国产蜜臀av在线一区二区三区| 国产精品久久精品日日| 懂色av噜噜一区二区三区av| 亚洲不卡一区二区三区| 免费国产亚洲视频| 丁香婷婷综合激情五月色| 色婷婷综合中文久久一本| 欧美精品三级日韩久久| 亚洲精品一区二区三区99| 国产精品福利一区二区三区| 亚洲成人在线免费| 香蕉av福利精品导航| 久久不见久久见免费视频1| 久久66热偷产精品| 91麻豆自制传媒国产之光| 欧美男男青年gay1069videost | 国产精品无人区| 亚洲18影院在线观看| 成人a级免费电影| 欧美一区二区在线播放| 国产精品日产欧美久久久久| 日本成人在线视频网站| 91在线观看免费视频| 2023国产精华国产精品| 一区二区三区精品| 成人美女视频在线看| 欧美大片在线观看一区| 亚洲一区二区视频在线| 懂色av一区二区三区免费看| 欧美一区二区三区男人的天堂| 亚洲色图视频免费播放| 国产乱人伦偷精品视频免下载| 欧美性色aⅴ视频一区日韩精品| 国产欧美一区二区精品婷婷| 美日韩一级片在线观看| 色综合久久久久久久久| 国产亚洲一区二区在线观看| 青青草国产精品97视觉盛宴| 在线影院国内精品| 国产精品理伦片| 国产制服丝袜一区| 日韩欧美亚洲国产另类 | 欧美色倩网站大全免费| 中文字幕一区二区在线播放| 欧美色综合影院| 国产精品高潮呻吟| 国产·精品毛片| 久久久久久久久一| 久久国内精品自在自线400部| 欧美男男青年gay1069videost| 亚洲伦理在线免费看| 99久久精品国产毛片| 国产精品免费av| 国产suv一区二区三区88区| 精品国产乱码久久久久久久久| 天堂成人国产精品一区| 欧美日韩五月天| 一级做a爱片久久| 日本高清不卡在线观看| 亚洲精品乱码久久久久久黑人| 成人高清伦理免费影院在线观看| 亚洲精品一区二区三区在线观看| 日本欧美肥老太交大片| 欧美日韩在线播放| 午夜伦欧美伦电影理论片| 欧美日韩国产乱码电影| 亚洲午夜一区二区| 欧美调教femdomvk| 亚洲v中文字幕| 欧美精品日日鲁夜夜添| 青青草原综合久久大伊人精品优势| 在线成人av网站| 免费成人性网站| 精品裸体舞一区二区三区| 韩国欧美国产1区| 亚洲精品在线电影| 国产91高潮流白浆在线麻豆| 国产精品另类一区| 99热精品一区二区| 一区二区三区在线观看欧美 | 亚洲国产视频在线| 欧美精品色一区二区三区| 蜜桃久久av一区| 久久久噜噜噜久久中文字幕色伊伊| 国产乱对白刺激视频不卡 | av不卡免费在线观看| 日韩毛片一二三区| 欧美三级视频在线观看| 奇米四色…亚洲| 国产日产欧美一区二区视频| 99国产精品久久久| 亚洲成人免费看| 26uuu国产日韩综合| www.欧美精品一二区| 福利91精品一区二区三区| 亚洲免费观看在线视频| 欧美日韩精品欧美日韩精品一 | 在线观看91精品国产入口| 五月激情综合婷婷| 丝瓜av网站精品一区二区 | 国产精品乱码一区二区三区软件 | 亚洲一区影音先锋| 91精品国产综合久久久久久久久久 | 九九九久久久精品| 国产精品卡一卡二卡三| 欧美三级视频在线播放| 国产一区在线视频| 亚洲黄色小视频| 精品国产露脸精彩对白| 色婷婷av一区二区三区软件| 麻豆精品一区二区三区| 亚洲欧美在线高清| 欧美日韩精品欧美日韩精品一 | 国产精品三级视频| 色婷婷国产精品综合在线观看| 国产精品久久免费看| 99综合电影在线视频| 五月婷婷久久综合| 精品国偷自产国产一区| 成人亚洲一区二区一| 亚洲一区二区三区四区在线观看 | 婷婷成人激情在线网| 日韩欧美成人一区| 成人黄色大片在线观看| 一区二区三区丝袜| 精品国产乱码91久久久久久网站| 成人av网站大全| 日本不卡在线视频| 国产精品久久久久久久第一福利 | 欧美国产日韩精品免费观看| 91免费国产在线| 亚洲福利视频导航| 国产精品美女久久久久久久 | 亚洲视频综合在线| 日韩色在线观看| av电影一区二区| 日韩精品免费专区| 亚洲欧美日韩一区二区三区在线观看| 777午夜精品视频在线播放| 国产九色sp调教91| 亚洲成人在线观看视频| 国产婷婷一区二区| 51精品视频一区二区三区| 成人激情文学综合网| 青娱乐精品视频| 亚洲另类春色国产| 久久久久国产精品人| 日韩欧美不卡一区| 欧美又粗又大又爽| 国产不卡视频一区| 美女一区二区久久| 中文字幕在线不卡一区二区三区| 26uuu久久综合| 欧美日韩国产小视频在线观看| 成人精品免费网站| 精品一区二区三区免费视频| 亚洲图片欧美色图| 亚洲自拍偷拍综合| 中文字幕在线不卡一区二区三区 | 国内精品伊人久久久久av影院 | 欧美日韩一区三区| 99视频一区二区| 成人av在线播放网站| 精品在线视频一区| 日韩激情在线观看| 亚洲一二三区不卡| 亚洲天堂av一区| 亚洲精品一卡二卡| 国产精品系列在线| 久久日韩精品一区二区五区| 欧美丰满高潮xxxx喷水动漫| 国产二区国产一区在线观看| 国产福利精品一区二区| 久久99精品国产.久久久久久| 图片区日韩欧美亚洲| 亚洲高清三级视频| 亚洲精品综合在线| 一区二区三区中文字幕电影 | 亚洲第一二三四区| 午夜伊人狠狠久久| 亚洲一区二区三区国产| 亚洲老妇xxxxxx| 亚洲欧美日韩国产综合| 亚洲免费三区一区二区| 亚洲色图欧美激情| 亚洲色图色小说| 亚洲免费视频中文字幕| 一级中文字幕一区二区| 亚洲黄色小说网站| 一区二区国产盗摄色噜噜| 亚洲免费视频成人| 国产精品国产三级国产a| 一区二区三区中文字幕| 亚洲午夜精品在线| 五月婷婷综合网|