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

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

?? spider.java

?? 網絡機器人
?? JAVA
字號:
/** * The Spider class is the main organizational class for * spidering.  It delegates work to the SpiderWorker class. * * Copyright 2001-2003 by Jeff Heaton (http://www.jeffheaton.com) * * @author Jeff Heaton * @version 1.0 */package com.heaton.bot;import java.util.*;import java.io.*;import java.lang.reflect.*;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.   *   * If you do not need a custom spider worker or    * workload management, this is the constructor to use.   *   * @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)  {      try      {        init(manager,url,http.getClass(),SpiderWorker.class,poolSize,w);      }      // mostly ignore the exceptions since we're using the standard SpiderWorker stuff      catch(InstantiationException e)      {          Log.logException("Spider reflection exception",e);      }      catch(NoSuchMethodException e)      {          Log.logException("Spider reflection exception",e);      }            catch(IllegalAccessException e)      {          Log.logException("Spider reflection exception",e);      }            catch(InvocationTargetException e)      {          Log.logException("Spider reflection exception",e);      }              }    /**   * 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.   *   * This constructor was added to allow you to specify   * a custom SpiderWorker class. Though not usually necessary   * this will allow you exact control over the HTML parse.   *   * @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 worker A SpiderWorker class to be used to process the pages.   * @param poolsize The size of the thread pool.   * @param w A customized workload manager.   */  private Spider(ISpiderReportable manager,String url,Class http,Class worker,int poolSize,IWorkloadStorable w)    throws InstantiationException,NoSuchMethodException,IllegalAccessException,InvocationTargetException    {      init(manager,url,http,worker,poolSize,w);  }      /**   * Internal method that is called by the various constructors to setup the spider.   *   * @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 http The spider worker   * @param poolsize The size of the thread pool.   * @param w A customized workload manager.   */  private void init(ISpiderReportable manager,String url,Class http,Class worker,int poolSize,IWorkloadStorable w)    throws InstantiationException,NoSuchMethodException,IllegalAccessException,InvocationTargetException    {    this.manager = manager;    worldSpider = false;        Class types[] = { Spider.class,HTTP.class };    Constructor constructor = worker.getConstructor(types);        pool = new SpiderWorker[poolSize];    for ( int i=0;i<pool.length;i++ ) {      HTTP hc = (HTTP)http.newInstance();      Object params[]={this,hc};            pool[i] = (SpiderWorker)constructor.newInstance(params);    }    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)  {    workload.completeWorkload(page.getURL(),error);    // if this was a redirect, then also complete the root page    if ( page.getURL().equals(page.getRootURL()) )      workload.completeWorkload(page.getRootURL(),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一区二区三区免费野_久草精品视频
丰满白嫩尤物一区二区| 99久精品国产| av综合在线播放| 日韩精品一区二区在线| 日本色综合中文字幕| 国产精一品亚洲二区在线视频| 欧美顶级少妇做爰| 亚洲乱码国产乱码精品精98午夜 | 91丨porny丨蝌蚪视频| 日韩一级免费一区| 亚洲自拍另类综合| 99r精品视频| 日本一二三四高清不卡| 久久99精品一区二区三区三区| 欧美日韩高清影院| 一区二区三区四区乱视频| 成a人片亚洲日本久久| 日本一区二区三区四区| 国产精品一区二区免费不卡| 日韩一区二区精品葵司在线| 亚洲国产成人av| 欧洲av在线精品| 亚洲美女在线一区| 色综合久久久久综合体| 成人欧美一区二区三区视频网页| 懂色av一区二区夜夜嗨| 久久久99久久| 不卡av在线免费观看| 国产精品丝袜91| 99久精品国产| 亚洲制服欧美中文字幕中文字幕| 在线观看网站黄不卡| 亚洲精品国产高清久久伦理二区| 欧美久久一二三四区| 久久午夜电影网| 男人的天堂亚洲一区| 欧美精品久久99久久在免费线 | 亚洲人成7777| 国产精品亚洲第一| 欧美经典一区二区三区| 国产成人av一区二区三区在线观看| 日韩美女一区二区三区四区| 极品美女销魂一区二区三区免费 | 蜜桃91丨九色丨蝌蚪91桃色| 日韩欧美中文字幕制服| 国内一区二区视频| 久久精品亚洲精品国产欧美| 丁香六月久久综合狠狠色| 中文字幕在线一区免费| av亚洲精华国产精华| 夜夜嗨av一区二区三区四季av | 99国产欧美另类久久久精品| 久久这里只有精品视频网| 日韩电影一区二区三区四区| 日韩一级大片在线观看| 久久国产尿小便嘘嘘尿| 欧美激情在线免费观看| 在线这里只有精品| 美美哒免费高清在线观看视频一区二区 | 粉嫩13p一区二区三区| 亚洲人成网站影音先锋播放| 欧美老女人第四色| 床上的激情91.| 亚洲在线一区二区三区| 精品国产乱码久久久久久久久| jizzjizzjizz欧美| 午夜精品久久久久久久久久| 国产欧美一区二区三区网站| 在线免费观看日韩欧美| 国产在线播放一区三区四| 一区二区三区资源| 亚洲精品一线二线三线| 色婷婷综合久久久久中文一区二区| 免费高清在线视频一区·| 综合激情成人伊人| 久久毛片高清国产| 欧美精品在线一区二区| 99re亚洲国产精品| 久久av资源网| 亚洲一区二区三区在线| 日韩毛片视频在线看| 欧美一级欧美三级在线观看| av网站一区二区三区| 精品一区二区三区在线视频| 一区二区三区欧美久久| 国产午夜精品美女毛片视频| 欧美一区二区三区在线看| 色婷婷精品大视频在线蜜桃视频| 国产精品一区三区| 久久精品久久综合| 日韩在线卡一卡二| 亚洲一区中文日韩| 亚洲久本草在线中文字幕| 26uuu欧美日本| 欧美大肚乱孕交hd孕妇| 欧美日韩国产免费一区二区| 色偷偷久久一区二区三区| 成人av免费网站| 久久99国产乱子伦精品免费| 日韩电影在线观看一区| 天堂资源在线中文精品| 亚洲一区二区3| 一个色在线综合| 亚洲一区二区三区四区五区黄| 亚洲视频一区二区免费在线观看| 欧美国产日韩亚洲一区| 久久久久久夜精品精品免费| 精品国产sm最大网站| 欧美成人精品1314www| 日韩一区二区电影在线| 91精品国产日韩91久久久久久| 欧美日韩电影一区| 欧美日韩成人在线| 91精品国产综合久久福利软件 | 欧美中文字幕久久| 欧美色网一区二区| 欧美性xxxxxxxx| 欧美一卡2卡3卡4卡| 日韩免费观看高清完整版| 日韩女优电影在线观看| 久久综合色播五月| 欧美激情中文不卡| 亚洲激情图片小说视频| 天天亚洲美女在线视频| 免费人成在线不卡| 国产精品自拍一区| 成人av综合一区| 欧美性生交片4| 日韩亚洲欧美高清| 国产欧美日韩精品a在线观看| 国产精品亲子乱子伦xxxx裸| 一区二区三区在线播放| 天天影视涩香欲综合网| 国产精品一区二区你懂的| 99re这里只有精品首页| 欧美视频一区在线观看| 精品奇米国产一区二区三区| 国产人成亚洲第一网站在线播放| 亚洲欧美日韩中文字幕一区二区三区 | 国产一区二区在线观看免费| www.久久精品| 欧美日韩精品一区二区三区四区 | 亚洲美女电影在线| 丝袜亚洲精品中文字幕一区| 国产成人啪午夜精品网站男同| 91麻豆视频网站| 日韩三区在线观看| 1000部国产精品成人观看| 首页国产欧美日韩丝袜| 成人av在线一区二区| 欧美日韩大陆一区二区| 国产精品污www在线观看| 丝袜a∨在线一区二区三区不卡| 国产乱码精品一区二区三区忘忧草| 色爱区综合激月婷婷| 久久久久国产精品麻豆ai换脸 | 欧美日韩极品在线观看一区| 国产欧美一区二区精品性色| 亚洲第一激情av| 成人高清伦理免费影院在线观看| 欧美日韩国产综合久久 | 国产午夜精品一区二区三区四区| 一级女性全黄久久生活片免费| 国内国产精品久久| 欧美美女bb生活片| 国产精品福利电影一区二区三区四区 | 日韩av在线免费观看不卡| 成人免费视频国产在线观看| 日韩精品一区二区在线| 亚洲成人激情社区| 色诱亚洲精品久久久久久| 国产网红主播福利一区二区| 免费久久99精品国产| 欧美日韩国产区一| 一区二区不卡在线视频 午夜欧美不卡在 | 亚洲精品久久嫩草网站秘色| 国产剧情一区二区| 欧美一区二区不卡视频| 五月天久久比比资源色| 在线观看精品一区| 亚洲欧洲www| 成人精品在线视频观看| 久久久久久久久蜜桃| 老司机精品视频线观看86| 正在播放亚洲一区| 亚洲成人777| 欧美老年两性高潮| 日韩精品久久理论片| 欧美日韩在线播放三区| 一区二区三国产精华液| 色八戒一区二区三区| 亚洲精品欧美专区| 色综合久久88色综合天天免费| 国产精品亲子乱子伦xxxx裸| 成人性视频网站| 亚洲欧美一区二区三区国产精品| 94色蜜桃网一区二区三区| 亚洲欧美日韩中文播放| 一本色道亚洲精品aⅴ| 亚洲男女一区二区三区|