Repository: netty/netty
File: resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java (Java)

Code before:
    }

    public DnsCache getOrNewCache() {
        if (this.resolveCache != null) {
            return this.resolveCache;
        }
        return new DefaultDnsCache(intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE), intValue(negativeTtl, 0));
    }

    public AuthoritativeDnsServerCache getOrNewAuthoritativeDnsServerCache() {
        if (this.authoritativeDnsServerCache != null) {
            return this.authoritativeDnsServerCache;
        }
        return new DefaultAuthoritativeDnsServerCache(
                intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE),
                // Let us use the sane ordering as DnsNameResolver will be used when returning
                // nameservers from the cache.
                new NameServerComparator(DnsNameResolver.preferredAddressType(resolvedAddressTypes).addressType()));
    }

    private DnsServerAddressStream newQueryServerAddressStream(
            DnsServerAddressStreamProvider dnsServerAddressStreamProvider) {
        return new ThreadLocalNameServerAddressStream(dnsServerAddressStreamProvider);
    }

    public DnsCnameCache getOrNewCnameCache() {
        if (this.cnameCache != null) {
            return this.cnameCache;
        }
        return new DefaultDnsCnameCache(
                intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE));
    }

    /**
     * Set if domain / host names should be decoded to unicode when received.
     * See <a href="https://tools.ietf.org/html/rfc3492">rfc3492</a>.
     *
     * @param decodeIdn if should get decoded
     * @return {@code this}
     */
    public DnsNameResolverBuilder decodeIdn(boolean decodeIdn) {
        this.decodeIdn = decodeIdn;
        return this;
    }

    /**
     * Set the maximum size of the cache that is used to consolidate lookups for different hostnames when in-flight.
     * This means if multiple lookups are done for the same hostname and still in-flight only one actual query will
     * be made and the result will be cascaded to the others.
     *
     * @param maxNumConsolidation the maximum lookups to consolidate (different hostnames), or {@code 0} if

Review comment (performance):
```suggestion
   DnsCnameCache getOrNewCnameCache() {
```

Code after:
    }

   DnsCache getOrNewCache() {
        if (this.resolveCache != null) {
            return this.resolveCache;
        }
        return new DefaultDnsCache(intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE), intValue(negativeTtl, 0));
    }

   AuthoritativeDnsServerCache getOrNewAuthoritativeDnsServerCache() {
        if (this.authoritativeDnsServerCache != null) {
            return this.authoritativeDnsServerCache;
        }
        return new DefaultAuthoritativeDnsServerCache(
                intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE),
                // Let us use the sane ordering as DnsNameResolver will be used when returning
                // nameservers from the cache.
                new NameServerComparator(DnsNameResolver.preferredAddressType(resolvedAddressTypes).addressType()));
    }

    private DnsServerAddressStream newQueryServerAddressStream(
            DnsServerAddressStreamProvider dnsServerAddressStreamProvider) {
        return new ThreadLocalNameServerAddressStream(dnsServerAddressStreamProvider);
    }

   DnsCnameCache getOrNewCnameCache() {
        if (this.cnameCache != null) {
            return this.cnameCache;
        }
        return new DefaultDnsCnameCache(
                intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE));
    }

    /**
     * Set if domain / host names should be decoded to unicode when received.
     * See <a href="https://tools.ietf.org/html/rfc3492">rfc3492</a>.
     *
     * @param decodeIdn if should get decoded
     * @return {@code this}
     */
    public DnsNameResolverBuilder decodeIdn(boolean decodeIdn) {
        this.decodeIdn = decodeIdn;
        return this;
    }

    /**
     * Set the maximum size of the cache that is used to consolidate lookups for different hostnames when in-flight.
     * This means if multiple lookups are done for the same hostname and still in-flight only one actual query will
     * be made and the result will be cascaded to the others.
     *
     * @param maxNumConsolidation the maximum lookups to consolidate (different hostnames), or {@code 0} if