Summary: Ctors | Methods | Inherited Methods
public
static
final
class
DnsOptions.Builder
extends Object
Builder for DnsOptions.
Summary
Public constructors | |
|---|---|
Builder()
|
|
Public methods | |
|---|---|
DnsOptions
|
build()
Creates and returns the final |
DnsOptions.Builder
|
setPersistHostCache(int state)
Sets whether the DNS cache should be persisted to disk. |
DnsOptions.Builder
|
setPersistHostCachePeriod(Duration persistHostCachePeriod)
Sets the minimum period between subsequent writes to disk for DNS cache persistence. |
DnsOptions.Builder
|
setPreestablishConnectionsToStaleDnsResults(int state)
Sets whether Cronet should use stale cached DNS records to pre-establish connections. |
DnsOptions.Builder
|
setStaleDns(int state)
Sets whether to use stale DNS results at all. |
DnsOptions.Builder
|
setStaleDnsOptions(DnsOptions.StaleDnsOptions staleDnsOptions)
Sets detailed configuration for stale DNS. |
DnsOptions.Builder
|
setUseHttpStackDnsResolver(int state)
Enables the use of the HTTP-stack-specific DNS resolver. |
Inherited methods | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From class
| |||||||||||||||||||||||
Public constructors
Builder
public Builder ()
Public methods
build
public DnsOptions build ()
Creates and returns the final DnsOptions instance, based on the values in this
builder.
| Returns | |
|---|---|
DnsOptions |
This value cannot be null. |
setPreestablishConnectionsToStaleDnsResults
public DnsOptions.Builder setPreestablishConnectionsToStaleDnsResults (int state)
Sets whether Cronet should use stale cached DNS records to pre-establish connections.
If enabled, Cronet will optimistically pre-establish connections to servers that matched the hostname at some point in the past and were cached but the cache entry expired. Such connections won't be used further until a new DNS lookup confirms the cached record was up to date.
To use cached DNS records straight away, use setStaleDns(int) and StaleDnsOptions configuration options.
This option may not be available for all networking protocols.
| Parameters | |
|---|---|
state |
int: one of the DNS_OPTION_* values.
Value is one of the following: |
| Returns | |
|---|---|
DnsOptions.Builder |
the builder for chaining.
This value cannot be null. |