Chapter 3. Netty components and design


This chapter covers

  • Technical and architectural aspects of Netty
  • Channel, EventLoop, and ChannelFuture
  • ChannelHandler and ChannelPipeline
  • Bootstrapping

In chapter 1 we presented a summary of the history and technical foundations of high-performance network programming in Java. This provided the background for an overview of Netty’s core concepts and building blocks.

In chapter 2 we expanded the scope of our discussion to application development. By building a simple client and server you learned about bootstrapping and gained hands-on experience with the all-important ChannelHandler API. Along the way, you also verified that your development tools were functioning properly.

As we build on this material in the rest of the book, we’ll explore Netty from two distinct but closely related points of view: as a class library and as a framework. Both are essential to writing efficient, reusable, and maintainable code with Netty.

From a high-level perspective, Netty addresses two corresponding areas of concern, which we might label broadly as technical and architectural. First, its asynchronous and event-driven implementation, built on Java NIO, guarantees maximum application performance and scalability under heavy load. Second, Netty embodies a set of design patterns that decouple application logic from the network layer, simplifying development while maximizing the testability, modularity, and reusability of code.

3.1. Channel, EventLoop, and ChannelFuture

3.2. ChannelHandler and ChannelPipeline

3.3. Bootstrapping

3.4. Summary