Netty processor chain architecture diagram and summary

data

Netty processor chain initialization source code analysis article
netty processor chain read data execution process source code analysis article
LineBasedFrameDecoder solves sticky package half package source code analysis article
netty sticky package half package problem common solutions and summary articles
netty processor chain architecture diagram and summary article

Processor role

1. The processor role is used to process IO events

2. Dealing with IO events will encounter different problems, so the design is based on the chain of responsibility model, a bit of a hierarchical concept, multiple processors work at the same time to solve different problems, and the package is half packaged with one processor, and then The complete package is given to the next processor, the new processor is used to solve the deserialization processing business

3. The chain of responsibility is just a structure of a singly linked list. Due to the use of read and write events and operations in the opposite order, the processor chain is actually bidirectional, and the bottom layer is designed as a doubly linked list.

4. Figure 1 is the details of the processor flow of the read event, and Figure 2 is a simplified overview of the read and write events

Read event processor chain architecture diagram

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-ILJn4hNM-1601053760726)(/Users/wuxinxin/Library/Application Support/typora-user-images/image-20200926004604421 .png)]

Processor chain overall architecture diagram

[External link image transfer failed. The origin site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-ousJb3s5-1601053760730)(/Users/wuxinxin/Library/Application Support/typora-user-images/image-20200926010326283) .png)]

to sum up

1. The processor chain is used to process IO events, using a typical responsibility chain + strategy model, so that the processor chain can be expanded horizontally or vertically

2. Horizontal expansion shows that a processor can have different implementations to meet the same function of the processor. Such as decoder

3. Vertical expansion means that processors can be increased infinitely, so that each processor has a single responsibility design principle and a hierarchical concept. For example, the relationship between the decoding processor and the deserialization processor

Guess you like

Origin blog.csdn.net/weixin_38312719/article/details/108807010