Netty 組件

Netty網絡抽象層組件

  • Channel—Sockets
  • EventLoop—Control flow, multithreading, concurrency
  • ChannelFuture—Asynchronous notification

Interface Channel

Netty’s Channel interface provides an API that greatly reduces the complexity of working directly with Sockets.

Interface EventLoop

The EventLoop defines Netty’s core abstraction for handling events that occur during the lifetime of a connection

Interface ChannelFuture

As we’ve explained, all I/O operations in Netty are asynchronous. Because an opera- tion may not return immediately, we need a way to determine its result at a later time

ChannelHandler and ChannelPipeline

manage the flow of data and execute an application’s processing logic

Interface ChannelHandler

serves as the container for all application logic

Interface ChannelPipeline

A ChannelPipeline provides a container for a chain of ChannelHandlers and defines an API for propagating the flow of inbound and outbound events along the chain

Encoders and decoders

When you send or receive a message with Netty, a data conversion takes place. An inbound message will be decoded; that is, converted from bytes to another format, typi- cally a Java object. If the message is outbound, the reverse will happen: it will be encoded to bytes from its current format.

Bootstrapping

Netty’s bootstrap classes provide containers for the configuration of an application’s network layer


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章