zoukankan      html  css  js  c++  java
  • GuozhongCrawler系列教程 (5) TransactionRequest具体解释

       为了实现和维护并发抓取的属性信息提供线程安全的事务请求。TransactionRequest是一个抽象类自己不能设置Processor,却须要实现 TransactionCallBack接口。TransactionRequest是个复合的BasicRequest。他能够将多个PageRequest、BinaryRequest甚至TransactionRequest 自己的对象加入到child集合中,在下载过程中首先下载TransactionRequest中的全部childRequest。每一个childRequest下载完毕后使用notify方式逐步向上通知。 直到全部的child下载完毕TransactionRequest回调 TransactionCallBack的callBack方法通知业务层这个TransactionRequest下载完毕。


    方法具体资料

    • getPipeline

      public Pipeline getPipeline()
    • setPipeline

      public void setPipeline(Pipeline pipeline)
    • getAttribute

      public java.lang.Object getAttribute(java.lang.String attribute)
      从类复制的说明: BasicRequest
      取得属性
      指定者:
      getAttribute 在类中 BasicRequest
      返回:
      返回attribute属性相应的value。没有则返回null
    • addChildRequest

      public void addChildRequest(BasicRequest request)
      加入一个BasicRequest到TransactionRequest的child中
      參数:
      request -
    • iteratorChildRequests

      public java.util.Iterator<BasicRequest> iteratorChildRequests()
      返回这个TransactionRequest全部child的迭代器
      返回:

    • notify

      public void notify(int hashcode)
      从类复制的说明: BasicRequest
      当子url或者当前url完毕的时候回调
      覆盖:
      notify 在类中 BasicRequest
      參数:
      hashcode - 实际Request的hashCode
    • checkComplete

      public void checkComplete()
      检查是否全部的Request标记都不是false。假设是那么全部的Request已经请求完毕和处理。


  • 相关阅读:
    mysql 常用函数
    JSP 分页代码
    day15(Mysql学习)
    day14(编码实战-用户登录注册)
    Bootstrap第3天
    Bootstrap第2天
    Bootstrap 第一天
    day13(JSTL和自定义标签&MVC模型&javaweb三层框架)
    label 对齐
    Alert提示框之后跳转指定页面
  • 原文地址:https://www.cnblogs.com/tlnshuju/p/6946387.html
Copyright © 2011-2022 走看看