The code for "Hello World" is simple, but some of the important concepts (classes) and Netty need to be simple and clear, at least knowing what they are responsible for. Convenient for later use and expansion of more flexible.
Statement, the author of a Code of agriculture, not so many professional vocabulary and abbreviations, only the most simple pale words to describe the feelings and experience of the individual. If you think this is too unprofessional, I can only be sorry first. Then, the author has turned "Netty code Analysis", you can refer to.
Channelevent
First say this channelevent, because Netty is event-driven, that is what we mentioned above, what happens, we inform the "relevant departments." Therefore, it is not difficult to understand that in our own business code, there must be some processing related to these events. In the sample code (http://www.it165.net/pro/html/201207/3142.html), we deal with the event that is channelconnected. Later, we will also deal with more events.
Channelpipeline
Pipeline, translated into Chinese means: pipelines, transmission channels. In other words, he is here to control the distribution and delivery of channelevent events. Events in the pipeline flow, the first stop to where, the second stop to where, to where is the end, is to use this channelpipeline treatment. For example: development events. First give a design, then to b development. A flow chart, hoping to give you a more intuitive feeling.
Channelhandler
Just said pipeline responsible for the incident distribution to the corresponding site, the site in Netty, that is, refers to Channelhandler. The incident to the Channelhandler here, is to be specifically processed, our sample code (http://www.it165.net/pro/html/201207/3142.html), the implementation is such a processing event "site", In other words, your own business logic usually starts here.
Channel
With the coordination of a department, we also need an overall grasp of the situation, the so-called "bigger Picture" department, Channel.
Channel, which can tell you the status of the current channel, together or off. Gets the channel-related configuration information. Get pipeline and so on. Are some of the overall information. The channel is naturally produced by ChannelFactory. The type of channel implementation determines whether you are synchronizing or asynchronous (NIO). For example, we use Nioserversocketchannel in our sample.
These basic concepts, you understand.
Java NIO Framework Netty Tutorial (ii) Vernacular concept