Uploaded image for project: 'Nutch'
  1. Nutch
  2. NUTCH-2625

ProtocolFactory.getProtocol(url) may create multiple plugin instances

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.15
    • 1.16
    • protocol
    • None

    Description

      The method ProtocolFactory.getProtocol(URL url) may create unnecessarily multiple instances of protocol plugins given the same configuration. The following snippets from a Fetcher using 100 FetcherThreads show that the setConf(conf) method of the protocol-okhttp plugin is called 100 times (once for each thread):

      2018-07-12 12:04:32,811 INFO [main] org.apache.nutch.fetcher.FetcherThread: FetcherThread 1 Using queue mode : byHost
      ... (skipped 98 repeated messages)
      2018-07-12 12:04:33,136 INFO [main] org.apache.nutch.fetcher.FetcherThread: FetcherThread 1 Using queue mode : byHost
      
      ...
      
      2018-07-12 12:04:37,493 INFO [FetcherThread] org.apache.nutch.protocol.RobotRulesParser: robots.txt whitelist not configured.
      2018-07-12 12:04:37,493 INFO [FetcherThread] org.apache.nutch.protocol.okhttp.OkHttp: http.proxy.host = null
      ...
      2018-07-12 12:04:37,494 INFO [FetcherThread] org.apache.nutch.protocol.okhttp.OkHttp: http.enable.cookie.header = false
      
      ... (skipped 98 blocks of repeated messages)
      
      2018-07-12 12:04:39,080 INFO [FetcherThread] org.apache.nutch.protocol.RobotRulesParser: robots.txt whitelist not configured.
      2018-07-12 12:04:39,080 INFO [FetcherThread] org.apache.nutch.protocol.okhttp.OkHttp: http.proxy.host = null
      ...
      2018-07-12 12:04:39,080 INFO [FetcherThread] org.apache.nutch.protocol.okhttp.OkHttp: http.enable.cookie.header = false
      

      The method ProtocolFactory.getProtocol(URL url) is synchronized, however each FetcherThread holds its own instance of the ProtocolFactory.

      Attachments

        Issue Links

          Activity

            People

              snagel Sebastian Nagel
              snagel Sebastian Nagel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: