Home / Function/ testNegativeTtl() — netty Function Reference

testNegativeTtl() — netty Function Reference

Architecture documentation for the testNegativeTtl() function in DnsNameResolverTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9bb71990_ed17_b0f4_b9d5_53924704622a["testNegativeTtl()"]
  b6215f36_0afe_a284_a3fd_3999e90a8e97["DnsNameResolverTest"]
  9bb71990_ed17_b0f4_b9d5_53924704622a -->|defined in| b6215f36_0afe_a284_a3fd_3999e90a8e97
  style 9bb71990_ed17_b0f4_b9d5_53924704622a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java lines 738–773

    @ParameterizedTest
    @EnumSource(DnsNameResolverChannelStrategy.class)
    public void testNegativeTtl(DnsNameResolverChannelStrategy strategy) throws Exception {
        final DnsNameResolver resolver = newResolver(strategy).negativeTtl(10).build();
        try {
            resolveNonExistentDomain(resolver);

            final int size = 10000;
            final List<UnknownHostException> exceptions = new ArrayList<UnknownHostException>();

            // If negative cache works, this thread should be done really quickly.
            final Thread negativeLookupThread = new Thread() {
                @Override
                public void run() {
                    for (int i = 0; i < size; i++) {
                        exceptions.add(resolveNonExistentDomain(resolver));
                        if (isInterrupted()) {
                            break;
                        }
                    }
                }
            };

            negativeLookupThread.start();
            negativeLookupThread.join(DEFAULT_TEST_TIMEOUT_MS);

            if (negativeLookupThread.isAlive()) {
                negativeLookupThread.interrupt();
                fail("Cached negative lookups did not finish quickly.");
            }

            assertEquals(size, exceptions.size());
        } finally {
            resolver.close();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testNegativeTtl() do?
testNegativeTtl() is a function in the netty codebase, defined in resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java.
Where is testNegativeTtl() defined?
testNegativeTtl() is defined in resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java at line 738.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free