Package org.archive.modules.net
Class CrawlHost
java.lang.Object
org.archive.modules.net.CrawlHost
- All Implemented Interfaces:
Serializable
,FetchStats.HasFetchStats
,org.archive.util.IdentityCacheable
public class CrawlHost extends Object implements Serializable, FetchStats.HasFetchStats, org.archive.util.IdentityCacheable
Represents a single remote "host".
An host is a name for which there is a dns record or an IP-address. This
might be a machine or a virtual host.
- Author:
- gojomo
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static long
IP_NEVER_EXPIRES
Flag value indicating always-valid IPstatic long
IP_NEVER_LOOKED_UP
Flag value indicating an IP has not yet been looked upprotected FetchStats
substats
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static void
autoregisterTo(org.archive.bdb.AutoKryo kryo)
boolean
equals(Object obj)
String
fixUpName()
String
getCountryCode()
Get country code of this hostlong
getEarliestNextURIEmitTime()
Get the earliest time a URI for this host could be emitted.String
getHostName()
Get the host name.InetAddress
getIP()
Get the IP address for this host.long
getIpFetched()
Get the time when the IP address for this host was last looked up.long
getIpTTL()
Get the TTL value from the dns record for this host.String
getKey()
FetchStats
getSubstats()
boolean
hasBeenLookedUp()
Return true if the IP for this host has been looked up.int
hashCode()
void
makeDirty()
void
setCountryCode(String countryCode)
Set country code for this hosvoid
setEarliestNextURIEmitTime(long earliestNextURIEmitTime)
Set the earliest time a URI for this host could be emitted.void
setIdentityCache(org.archive.util.ObjectIdentityCache<?> cache)
void
setIP(InetAddress address, long ttl)
Set the IP address for this host.String
toString()
-
Field Details
-
IP_NEVER_EXPIRES
public static final long IP_NEVER_EXPIRESFlag value indicating always-valid IP- See Also:
- Constant Field Values
-
IP_NEVER_LOOKED_UP
public static final long IP_NEVER_LOOKED_UPFlag value indicating an IP has not yet been looked up- See Also:
- Constant Field Values
-
substats
-
-
Constructor Details
-
CrawlHost
Create a new CrawlHost object.- Parameters:
hostname
- the host name for this host.
-
CrawlHost
Create a new CrawlHost object.- Parameters:
hostname
- the host name for this host.countryCode
- the country code for this host.
-
-
Method Details
-
hasBeenLookedUp
public boolean hasBeenLookedUp()Return true if the IP for this host has been looked up. Returns true even if the lookup failed.- Returns:
- true if the IP for this host has been looked up.
-
setIP
Set the IP address for this host.- Parameters:
address
-ttl
- the TTL from the dns record in seconds or -1 if it should live forever (is a numeric IP).
-
getIP
Get the IP address for this host.- Returns:
- the IP address for this host.
-
getIpFetched
public long getIpFetched()Get the time when the IP address for this host was last looked up.- Returns:
- the time when the IP address for this host was last looked up.
-
getIpTTL
public long getIpTTL()Get the TTL value from the dns record for this host.- Returns:
- the TTL value from the dns record for this host -- in seconds -- or -1 if this lookup should be valid forever (numeric ip).
-
toString
-
hashCode
public int hashCode() -
equals
-
getHostName
Get the host name.- Returns:
- Returns the host name.
-
getEarliestNextURIEmitTime
public long getEarliestNextURIEmitTime()Get the earliest time a URI for this host could be emitted. This only has effect if constraints on bandwidth per host is set.- Returns:
- Returns the earliestNextURIEmitTime.
-
setEarliestNextURIEmitTime
public void setEarliestNextURIEmitTime(long earliestNextURIEmitTime)Set the earliest time a URI for this host could be emitted. This only has effect if constraints on bandwidth per host is set.- Parameters:
earliestNextURIEmitTime
- The earliestNextURIEmitTime to set.
-
getCountryCode
Get country code of this host- Returns:
- Retruns country code or null if not availabe
-
setCountryCode
Set country code for this hos- Parameters:
countryCode
- The country code of this host
-
getSubstats
- Specified by:
getSubstats
in interfaceFetchStats.HasFetchStats
-
autoregisterTo
public static void autoregisterTo(org.archive.bdb.AutoKryo kryo) -
getKey
- Specified by:
getKey
in interfaceorg.archive.util.IdentityCacheable
-
makeDirty
public void makeDirty()- Specified by:
makeDirty
in interfaceorg.archive.util.IdentityCacheable
-
setIdentityCache
public void setIdentityCache(org.archive.util.ObjectIdentityCache<?> cache)- Specified by:
setIdentityCache
in interfaceorg.archive.util.IdentityCacheable
-
fixUpName
-