Home / Function/ testUnhealthyChannelIsOfferedWhenNoHealthCheckRequested() — netty Function Reference

testUnhealthyChannelIsOfferedWhenNoHealthCheckRequested() — netty Function Reference

Architecture documentation for the testUnhealthyChannelIsOfferedWhenNoHealthCheckRequested() function in SimpleChannelPoolTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  6bbbc43d_2d1c_2589_ce6c_f313e2fd83e0["testUnhealthyChannelIsOfferedWhenNoHealthCheckRequested()"]
  dfb428cc_ecc3_d271_5689_7e428381a986["SimpleChannelPoolTest"]
  6bbbc43d_2d1c_2589_ce6c_f313e2fd83e0 -->|defined in| dfb428cc_ecc3_d271_5689_7e428381a986
  style 6bbbc43d_2d1c_2589_ce6c_f313e2fd83e0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/pool/SimpleChannelPoolTest.java lines 209–245

    @Test
    public void testUnhealthyChannelIsOfferedWhenNoHealthCheckRequested() throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
        LocalAddress addr = new LocalAddress(getLocalAddrId());
        Bootstrap cb = new Bootstrap();
        cb.remoteAddress(addr);
        cb.group(group)
          .channel(LocalChannel.class);

        ServerBootstrap sb = new ServerBootstrap();
        sb.group(group)
          .channel(LocalServerChannel.class)
          .childHandler(new ChannelInitializer<LocalChannel>() {
              @Override
              public void initChannel(LocalChannel ch) throws Exception {
                  ch.pipeline().addLast(new ChannelInboundHandlerAdapter());
              }
          });

        // Start server
        Channel sc = sb.bind(addr).syncUninterruptibly().channel();
        ChannelPoolHandler handler = new CountingChannelPoolHandler();
        ChannelPool pool = new SimpleChannelPool(cb, handler, ChannelHealthChecker.ACTIVE, false);
        Channel channel1 = pool.acquire().syncUninterruptibly().getNow();
        channel1.close().syncUninterruptibly();
        Future<Void> releaseFuture =
                pool.release(channel1, channel1.eventLoop().<Void>newPromise()).syncUninterruptibly();
        assertTrue(releaseFuture.isSuccess());

        Channel channel2 = pool.acquire().syncUninterruptibly().getNow();
        //verifying that in fact the channel2 is different that means is not pulled from the pool
        assertNotSame(channel1, channel2);
        sc.close().syncUninterruptibly();
        channel2.close().syncUninterruptibly();
        pool.close();
        group.shutdownGracefully();
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free