君子博学而日参省乎己 则知明而行无过矣

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 106 下一页

2013年4月23日 #

摘要: 我们接下来分析与与BdbFrontier对象CrawlURI next()方法相关的方法/** * Return the next CrawlURI eligible to be processed (and presumably * visited/fetched) by a a worker thread. * * Relies on the readyClassQueues having been loaded with * any work queues that are eligible to provide a URI. * ... 阅读全文
posted @ 2013-04-23 06:57 刺猬的温驯 阅读(824) 评论(0) 推荐(0) 编辑

2013年4月21日 #

摘要: 本文分析Heritrix3.1.0系统里面的WorkQueue队列(具体是BdbWorkQueue)的调度机制,这部分是系统里面比较复杂的,我只能是尝试分析(本文可能会修改)我在Heritrix 3.1.0 源码解析(六)一文中涉及BdbFrontier对象的初始化,现在回顾一下我们看到在WorkQueueFrontier类中的初始化方法void start()里面进一步调用了void initInternalQueues()方法而void initInternalQueues()方法 里面进一步调用子类BdbFrontier的void initOtherQueues()方法与void ini 阅读全文
posted @ 2013-04-21 10:02 刺猬的温驯 阅读(797) 评论(0) 推荐(0) 编辑

2013年4月20日 #

摘要: 我在分析BdbFrontier对象的void schedule(CrawlURI caURI)、CrawlURI next() 、void finished(CrawlURI cURI)方法是,其实还有一些相关环境没有分析,其实我是有点疲倦本文接下来分析在多线程环境中Heritrix3.1.0系统怎样保持相关对象属性的一致性以及怎样自定义配置相关对象的属性值我们在WorkQueueFrontier类的void schedule(CrawlURI curi)方法里面可以看到@Override public void schedule(CrawlURI curi) { shee... 阅读全文
posted @ 2013-04-20 12:47 刺猬的温驯 阅读(887) 评论(3) 推荐(0) 编辑

摘要: 接下来分析BdbFrontier类的void finished(CrawlURI curi) 方法,完成CrawlURI对象的扫尾工作在BdbFrontier类的父类的父类AbstractFrontier里面org.archive.crawler.frontier.BdbFrontier org.archive.crawler.frontier.AbstractFrontier/** * Note that the previously emitted CrawlURI has completed * its processing (for now). * ... 阅读全文
posted @ 2013-04-20 07:16 刺猬的温驯 阅读(792) 评论(0) 推荐(0) 编辑

摘要: 接下来分析BdbFrontier类的CrawlURI next()方法,该方法是获取下一个待采集的CrawlURI对象该方法是在BdbFrontier类的父类的父类AbstractFrontier里面org.archive.crawler.frontier.BdbFrontier org.archive.crawler.frontier.AbstractFrontier/* (non-Javadoc) * @see org.archive.crawler.framework.Frontier#next() */ public CrawlURI next() thr... 阅读全文
posted @ 2013-04-20 07:02 刺猬的温驯 阅读(1029) 评论(0) 推荐(0) 编辑

摘要: 上文分析了Heritrix3.1.0系统是怎么添加CrawlURI curi对象的,那么在系统初始化的时候,是怎么载入CrawlURI curi种子的呢?我们回顾前面的文章,在我们执行采集任务的launch指令的时候,实际会调用CrawlController对象的void requestCrawlStart()方法/** * Operator requested crawl begin */ public void requestCrawlStart() { hasStarted = true; sendCrawlStateChangeEv... 阅读全文
posted @ 2013-04-20 06:38 刺猬的温驯 阅读(795) 评论(0) 推荐(0) 编辑

2013年4月19日 #

摘要: 本文要分析的是Heritrix3.1.0的Frontier组件,先熟悉一下相关的UML类图通过浏览该图,我们可以清楚的看出Frontier组件的相关接口和类的继承和调用关系,不必我再文字描述了在分析BdbFrontier类的相关方法之前,有必要熟悉一下在系统环境中该对象的初始状态,以及状态的改变这部分内容需要回顾Heritrix 3.1.0 源码解析(六)一文,本人就不在这里重复了BdbFrontier类重要的有几个方法,分别是添加CrawlURI,获取CrawlURI,完成CrawlURIvoid schedule(CrawlURI curi)CrawlURI next()void fini 阅读全文
posted @ 2013-04-19 04:38 刺猬的温驯 阅读(1381) 评论(1) 推荐(0) 编辑

摘要: Heritrix3.1.0系统里面Frontier组件管理链接队列,采用的是BDB数据库,利用BDB数据库来存储CrawlURI对象,首先我们来看Heritrix3.1.0是怎么实现BDB模块的我们知道,创建BDB数据库首先要构建数据库环境,Heritrix3.1.0的BDB模块里面EnhancedEnvironment类实现了对BDB数据库环境的封装(继承自je的Environment),如果你不熟悉BDB数据库,可以先google一下吧EnhancedEnvironment类的源码如下:/** * Version of BDB_JE Environment with additional 阅读全文
posted @ 2013-04-19 04:37 刺猬的温驯 阅读(1663) 评论(0) 推荐(0) 编辑

摘要: 本文接着分析存储CrawlURI curi的队列容器,最重要的是BdbWorkQueue类及BdbMultipleWorkQueues类BdbWorkQueue类继承自抽象类WorkQueue,抽象类WorkQueue最重要的方法是long enqueue(final WorkQueueFrontier frontier,CrawlURI curi)CrawlURI peek(final WorkQueueFrontier frontier)void dequeue(final WorkQueueFrontier frontier, CrawlURI expected)分别为添加CrawlUR 阅读全文
posted @ 2013-04-19 04:36 刺猬的温驯 阅读(1414) 评论(0) 推荐(0) 编辑

摘要: 本文接下来分析上文涉及到的ObjectIdentityCache接口及相关对象先熟悉一下继承和依赖关系,简要UML类图如下:我们先来了解一下ObjectIdentityCache接口的源码(泛型接口)/** * An object cache for create-once-by-name-and-then-reuse objects. * * Objects are added, but never removed. Subsequent get()s using the * same key will return the exact same object, UNLESS all ... 阅读全文
posted @ 2013-04-19 04:35 刺猬的温驯 阅读(1287) 评论(0) 推荐(0) 编辑

上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 106 下一页