Class BaseDelayResolverConfig
java.lang.Object
com.norconex.crawler.web.doc.operations.delay.impl.BaseDelayResolverConfig
- Direct Known Subclasses:
GenericDelayResolverConfig,ReferenceDelayResolverConfig
Base implementation for creating voluntary delays between URL downloads. This base class offers a few ways the actual delay value can be defined (in order):
- Takes the delay specify by a robots.txt file. Only applicable if robots.txt files and its robots crawl delays are not ignored.
- Takes an explicitly specified delay, as per implementing class.
- Use the specified default delay or 3 seconds, if none is specified.
One of these following scope dictates how the delay is applied, listed in order from the best behaved to the least.
- CRAWLER: the delay is applied between each URL download within a crawler instance, regardless how many threads are defined within that crawler, or whether URLs are from the same site or not. This is the default scope.
- SITE: the delay is applied between each URL download from the same site within a crawler instance, regardless how many threads are defined. A site is defined by a URL protocol and its domain (e.g. http://example.com).
- THREAD: the delay is applied between each URL download from any given thread. The more threads you have the less of an impact the delay will have.
- Since:
- 2.5.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault delay is 3 seconds.static final BaseDelayResolverConfig.DelayResolverScope -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanThe default delay.getScope()Gets the delay scope.inthashCode()booleanWhether to ignore crawl delays specified in a site robots.txt file.setDefaultDelay(Duration defaultDelay) The default delay.setIgnoreRobotsCrawlDelay(boolean ignoreRobotsCrawlDelay) Whether to ignore crawl delays specified in a site robots.txt file.Gets the delay scope.toString()
-
Field Details
-
DEFAULT_DELAY
Default delay is 3 seconds. -
DEFAULT_SCOPE
-
-
Constructor Details
-
BaseDelayResolverConfig
public BaseDelayResolverConfig()
-
-
Method Details
-
getDefaultDelay
The default delay. -
isIgnoreRobotsCrawlDelay
public boolean isIgnoreRobotsCrawlDelay()Whether to ignore crawl delays specified in a site robots.txt file. Not applicable when robots.txt are ignored. -
getScope
Gets the delay scope. See class documentation for a description of supported scopes. -
setDefaultDelay
The default delay.- Returns:
this.
-
setIgnoreRobotsCrawlDelay
Whether to ignore crawl delays specified in a site robots.txt file. Not applicable when robots.txt are ignored.- Returns:
this.
-
setScope
Gets the delay scope. See class documentation for a description of supported scopes.- Returns:
this.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-