Class GenericDelayResolver
java.lang.Object
com.norconex.crawler.web.doc.operations.delay.impl.AbstractDelayResolver<GenericDelayResolverConfig>
com.norconex.crawler.web.doc.operations.delay.impl.GenericDelayResolver
- All Implemented Interfaces:
Configurable<GenericDelayResolverConfig>,EventListener<Event>,DelayResolver,EventListener,Consumer<Event>
public class GenericDelayResolver
extends AbstractDelayResolver<GenericDelayResolverConfig>
implements EventListener<Event>
Default implementation for creating voluntary delays between URL downloads. There are 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 scheduled delay, if any (picks the first one matching).
- Use the specified default delay or 3 seconds, if none is specified.
In a delay schedule, the days of weeks are spelled out (in English): Monday, Tuesday, etc. Time ranges are using the 24h format.
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.
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.norconex.crawler.web.doc.operations.delay.impl.AbstractDelayResolver
delay
-
Constructor Details
-
GenericDelayResolver
public GenericDelayResolver()
-
-
Method Details
-
accept
-
resolveExplicitDelay
Description copied from class:AbstractDelayResolverResolves explicitly specified delay, in milliseconds. This method is only invoked when there are no delays from robots.txt. If the implementing class does not have a delay resolution, -1 ornullis returned (the default delay will be used).- Specified by:
resolveExplicitDelayin classAbstractDelayResolver<GenericDelayResolverConfig>- Parameters:
url- URL for which to resolve delay- Returns:
- delay in millisecond, or -1 or
null
-
equals
- Overrides:
equalsin classAbstractDelayResolver<GenericDelayResolverConfig>
-
canEqual
- Overrides:
canEqualin classAbstractDelayResolver<GenericDelayResolverConfig>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractDelayResolver<GenericDelayResolverConfig>
-
toString
- Overrides:
toStringin classAbstractDelayResolver<GenericDelayResolverConfig>
-
getConfiguration
- Specified by:
getConfigurationin interfaceConfigurable<GenericDelayResolverConfig>
-