Home / Function/ testAcquire() — netty Function Reference

testAcquire() — netty Function Reference

Architecture documentation for the testAcquire() function in FixedChannelPoolTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  576ed140_663c_f8e2_b028_2d5c2b4ccf92["testAcquire()"]
  92761f16_3144_6791_29c9_00f65a091a8f["FixedChannelPoolTest"]
  576ed140_663c_f8e2_b028_2d5c2b4ccf92 -->|defined in| 92761f16_3144_6791_29c9_00f65a091a8f
  style 576ed140_663c_f8e2_b028_2d5c2b4ccf92 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/pool/FixedChannelPoolTest.java lines 70–97

    @Test
    public void testAcquire() throws Exception {
        Tuple t = bootstrap();

        // Start server
        Channel sc = t.sb.bind(t.address).syncUninterruptibly().channel();
        CountingChannelPoolHandler handler = new CountingChannelPoolHandler();

        ChannelPool pool = new FixedChannelPool(t.cb, handler, 1, Integer.MAX_VALUE);

        Channel channel = pool.acquire().syncUninterruptibly().getNow();
        Future<Channel> future = pool.acquire();
        assertFalse(future.isDone());

        pool.release(channel).syncUninterruptibly();
        assertTrue(future.await(1, TimeUnit.SECONDS));

        Channel channel2 = future.getNow();
        assertSame(channel, channel2);
        assertEquals(1, handler.channelCount());

        assertEquals(2, handler.acquiredCount());
        assertEquals(1, handler.releasedCount());

        sc.close().syncUninterruptibly();
        channel2.close().syncUninterruptibly();
        pool.close();
    }

Domain

Subdomains

Frequently Asked Questions

What does testAcquire() do?
testAcquire() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/pool/FixedChannelPoolTest.java.
Where is testAcquire() defined?
testAcquire() is defined in transport/src/test/java/io/netty/channel/pool/FixedChannelPoolTest.java at line 70.

Analyze Your Own Codebase

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

Try Supermodel Free