Home / Class/ ByteEchoPeerBase Class — netty Architecture

ByteEchoPeerBase Class — netty Architecture

Architecture documentation for the ByteEchoPeerBase class in ByteEchoPeerBase.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  379bebcd_d565_3dae_c6b9_313138d1f960["ByteEchoPeerBase"]
  d30294ba_06e3_c99c_1bf4_f97d6c13d69f["ByteEchoPeerBase.java"]
  379bebcd_d565_3dae_c6b9_313138d1f960 -->|defined in| d30294ba_06e3_c99c_1bf4_f97d6c13d69f
  f1df653b_1e1d_ed60_dfad_88ce2374bd03["ByteEchoPeerBase()"]
  379bebcd_d565_3dae_c6b9_313138d1f960 -->|method| f1df653b_1e1d_ed60_dfad_88ce2374bd03
  a332caff_4f20_e293_c8ce_8c8f1590919c["run()"]
  379bebcd_d565_3dae_c6b9_313138d1f960 -->|method| a332caff_4f20_e293_c8ce_8c8f1590919c

Relationship Graph

Source Code

example/src/main/java/io/netty/example/udt/echo/rendezvousBytes/ByteEchoPeerBase.java lines 42–76

public class ByteEchoPeerBase {

    protected final int messageSize;
    protected final SocketAddress myAddress;
    protected final SocketAddress peerAddress;

    public ByteEchoPeerBase(int messageSize, SocketAddress myAddress, SocketAddress peerAddress) {
        this.messageSize = messageSize;
        this.myAddress = myAddress;
        this.peerAddress = peerAddress;
    }

    public void run() throws Exception {
        final ThreadFactory connectFactory = new DefaultThreadFactory("rendezvous");
        final EventLoopGroup connectGroup = new MultiThreadIoEventLoopGroup(1,
                connectFactory, NioIoHandler.newFactory(NioUdtProvider.BYTE_PROVIDER));
        try {
            final Bootstrap bootstrap = new Bootstrap();
            bootstrap.group(connectGroup)
                    .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
                    .handler(new ChannelInitializer<UdtChannel>() {
                        @Override
                        protected void initChannel(UdtChannel ch) throws Exception {
                            ch.pipeline().addLast(
                                    new LoggingHandler(LogLevel.INFO),
                                    new ByteEchoPeerHandler(messageSize));
                        }
                    });
            final ChannelFuture future = bootstrap.connect(peerAddress, myAddress).sync();
            future.channel().closeFuture().sync();
        } finally {
            connectGroup.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

What is the ByteEchoPeerBase class?
ByteEchoPeerBase is a class in the netty codebase, defined in example/src/main/java/io/netty/example/udt/echo/rendezvousBytes/ByteEchoPeerBase.java.
Where is ByteEchoPeerBase defined?
ByteEchoPeerBase is defined in example/src/main/java/io/netty/example/udt/echo/rendezvousBytes/ByteEchoPeerBase.java at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free