In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the meaning of Dubbo serialization". In daily operation, I believe that many people have doubts about what Dubbo serialization means. The editor consulted all kinds of data and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the meaning of Dubbo serialization?" Next, please follow the editor to study!
Dubbo serialization supports java, compactedjava, nativejava, fastjson, fst, hessian2, kryo, where the default is hessian2. Where java, compactedjava, and nativejava belong to the serialization of native java.
The entire Dubbo serialization class machine is elegant and has a single responsibility. The overall class diagram is as follows:
It is mainly organized in three dimensions: Serialization (serialization strategy), DataInput (deserialization, binary-> object), and DataOutput (serialization, object-> binary stream). The design of the above class diagram is very elegant, and the design principles followed are generally as follows:
Single responsibility, abstract Input, Output, Serialization, thus abstracting the class inheritance system of three dimensions.
Give priority to the use of class aggregation, classes in multiple dimensions respectively derived from three inheritance systems, and then use aggregation, Serialization aggregation input,output, a typical bridging pattern.
This section only briefly introduces the basic features of various serializations, and will focus on the coding principles of kryo and hession2 serialization in subsequent chapters.
Overview of kryo serialization
I will not repeat the introduction of kryo here. If you are in contact with kryo for the first time, please take a detailed look at: "Chinese translation of Kryo official documents": https://blog.csdn.net/fanjunjaden/article/details/72823866, there is a comprehensive concept of kryo serialization mechanism. After reading the above materials, you should know that kryo has the following typical characteristics.
1. Support generics
2. Types can be included in the serialized byte sequence, and there is no need to pass types when deserializing, and the corresponding API:
Public void writeClassAndObject (Output output, Object object)
Public Object readClassAndObject (Input input)
3. Support circular references
4, class registration mechanism, mainly when writing the full path name of the class, if the class is registered, it will assign a value of int type to replace the comprehensive string, which can reduce the size of the binary stream after serialization.
5. Kryo objects are not thread-safe, and ThreadLocal and Kryo object pools are usually used.
At this point, the study on "what is the meaning of Dubbo serialization" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.