org.apache.nutch.fetcher

## Class FetcherJob

- java.lang.Object
- - org.apache.hadoop.conf.Configured
  - - org.apache.nutch.util.NutchTool
    - - org.apache.nutch.fetcher.FetcherJob

- All Implemented Interfaces:
    Configurable, Tool

      public class FetcherJob
      extends NutchTool
      implements Tool

  Multi-threaded fetcher.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `FetcherJob.FetcherMapper` Mapper class for Fetcher.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `LOG`
    `static java.lang.String` | `PARSE_KEY`
    `static int` | `PERM_REFRESH_TIME`
    `static java.lang.String` | `PROTOCOL_REDIR`
    `static org.apache.avro.util.Utf8` | `REDIRECT_DISCOVERED`
    `static java.lang.String` | `RESUME_KEY`
    `static java.lang.String` | `SITEMAP`
    `static java.lang.String` | `SITEMAP_DETECT`
    `static java.lang.String` | `THREADS_KEY`

    - ### Fields inherited from class org.apache.nutch.util.NutchTool

      `currentJob, currentJobNum, numJobs, results, status`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FetcherJob()`
    `FetcherJob(Configuration conf)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `fetch(java.lang.String batchId, int threads, boolean shouldResume, int numTasks)` Run fetcher.
    `int` | `fetch(java.lang.String batchId, int threads, boolean shouldResume, int numTasks, boolean stmDetect, boolean sitemap)` Run fetcher.
    `java.util.Collection<WebPage.Field>` | `getFields(Job job)`
    `static void` | `main(java.lang.String[] args)`
    `java.util.Map<java.lang.String,java.lang.Object>` | `run(java.util.Map<java.lang.String,java.lang.Object> args)` Runs the tool, using a map of arguments.
    `int` | `run(java.lang.String[] args)`

    - ### Methods inherited from class org.apache.nutch.util.NutchTool

      `getProgress, getStatus, killJob, stopJob`

    - ### Methods inherited from class org.apache.hadoop.conf.Configured

      `getConf, setConf`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.hadoop.conf.Configurable

      `getConf, setConf`

- - ### Field Detail

    - #### PROTOCOL_REDIR

          public static final java.lang.String PROTOCOL_REDIR

      See Also:
        Constant Field Values

    - #### PERM_REFRESH_TIME

          public static final int PERM_REFRESH_TIME

      See Also:
        Constant Field Values

    - #### REDIRECT_DISCOVERED

          public static final org.apache.avro.util.Utf8 REDIRECT_DISCOVERED

    - #### RESUME_KEY

          public static final java.lang.String RESUME_KEY

      See Also:
        Constant Field Values

    - #### SITEMAP

          public static final java.lang.String SITEMAP

      See Also:
        Constant Field Values

    - #### SITEMAP_DETECT

          public static final java.lang.String SITEMAP_DETECT

      See Also:
        Constant Field Values

    - #### PARSE_KEY

          public static final java.lang.String PARSE_KEY

      See Also:
        Constant Field Values

    - #### THREADS_KEY

          public static final java.lang.String THREADS_KEY

      See Also:
        Constant Field Values

    - #### LOG

          protected static final org.slf4j.Logger LOG

  - ### Constructor Detail

    - #### FetcherJob

          public FetcherJob()

    - #### FetcherJob

          public FetcherJob(Configuration conf)

  - ### Method Detail

    - #### getFields

          public java.util.Collection<WebPage.Field> getFields(Job job)

    - #### run

          public java.util.Map<java.lang.String,java.lang.Object> run(java.util.Map<java.lang.String,java.lang.Object> args)
                                                               throws java.lang.Exception

      Description copied from class: `NutchTool`
      Runs the tool, using a map of arguments. May return results, or null.
      Specified by:
        `run` in class `NutchTool`
      Parameters:
        `args` - map of arguments
      Returns:
        results or null
      Throws:
        `java.lang.Exception`

    - #### fetch

          public int fetch(java.lang.String batchId,
                           int threads,
                           boolean shouldResume,
                           int numTasks)
                    throws java.lang.Exception

      Run fetcher.
      Parameters:
        `batchId` - batchId (obtained from Generator) or null to fetch all generated fetchlists
        `threads` - number of threads per map task
        `shouldResume` -
        `numTasks` - number of fetching tasks (reducers). If set to < 1 then use the default, which is mapreduce.job.reduces.
      Returns:
        0 on success
      Throws:
        `java.lang.Exception`

    - #### fetch

          public int fetch(java.lang.String batchId,
                           int threads,
                           boolean shouldResume,
                           int numTasks,
                           boolean stmDetect,
                           boolean sitemap)
                    throws java.lang.Exception

      Run fetcher.
      Parameters:
        `batchId` - batchId (obtained from Generator) or null to fetch all generated fetchlists
        `threads` - number of threads per map task
        `shouldResume` -
        `numTasks` - number of fetching tasks (reducers). If set to < 1 then use the default, which is mapreduce.job.reduces.
        `stmDetect` - If set true, sitemap detection is run.
        `sitemap` - If set true, only sitemap files is fetched, If set false, only normal urls is fetched.
      Returns:
        0 on success
      Throws:
        `java.lang.Exception`

    - #### run

          public int run(java.lang.String[] args)
                  throws java.lang.Exception

      Specified by:
        `run` in interface `Tool`
      Throws:
        `java.lang.Exception`

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Throws:
        `java.lang.Exception`

Copyright © 2019 The Apache Software Foundation