Home / Function/ testExpire() — netty Function Reference

testExpire() — netty Function Reference

Architecture documentation for the testExpire() function in DefaultDnsCacheTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  60af6d24_ab60_f9d0_b06c_ae6f1373dcdc["testExpire()"]
  6fc766f6_eb26_5b64_4561_08621961737e["DefaultDnsCacheTest"]
  60af6d24_ab60_f9d0_b06c_ae6f1373dcdc -->|defined in| 6fc766f6_eb26_5b64_4561_08621961737e
  style 60af6d24_ab60_f9d0_b06c_ae6f1373dcdc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/test/java/io/netty/resolver/dns/DefaultDnsCacheTest.java lines 44–73

    @Test
    public void testExpire() throws Throwable {
        InetAddress addr1 = InetAddress.getByAddress(new byte[] { 10, 0, 0, 1 });
        InetAddress addr2 = InetAddress.getByAddress(new byte[] { 10, 0, 0, 2 });
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory());

        try {
            EventLoop loop = group.next();
            final DefaultDnsCache cache = new DefaultDnsCache();
            cache.cache("netty.io", null, addr1, 1, loop);
            cache.cache("netty.io", null, addr2, 10000, loop);

            Throwable error = loop.schedule(new Callable<Throwable>() {
                @Override
                public Throwable call() {
                    try {
                        assertNull(cache.get("netty.io", null));
                        return null;
                    } catch (Throwable cause) {
                        return cause;
                    }
                }
            }, 1, TimeUnit.SECONDS).get();
            if (error != null) {
                throw error;
            }
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free