Java Serialization:
Java serialization serializes all the metadata and business data of the object class to be serialized into a byte stream, and it serializes everything on the entire inheritance relationship . The byte stream that it serializes is a complete description of the object's structure to the content, contains all the information, and is therefore less efficient and the byte stream is relatively large . But because it does serialize everything , it can be said that everything can be transferred and therefore more usable and reliable .
Hession Serialization:
Its implementation mechanism is focused on the data, with a simple method of type information . Just like an Integer a = 1,hessian is serialized into a stream like I 1, i means that int or integer,1 is the data content. And for complex objects, through the reflection mechanism of Java, Hessian all the properties of the object as a map to serialize , producing similar m className propertyName1 I 1 PropertyName S StringValue (presumably, exactly, forget) such a stream contains the basic type description and data content. In the serialization process, if an object appears before, Hessian inserts a block such as R index to represent a reference location, eliminating the time to serialize and deserialize again . The cost of doing this is that Hessian needs to do different things for different types (so Hessian is lazy and does not support short), and special handling is required for some special objects (such as Stacktraceelement). At the same time, there are some inconsistencies in some situations, such as a map obtained through COLLECTIONS.SYNCHRONIZEDMAP, because it is not going deep into the internal serialization of the implementation.
The difference between Java serialization and Hessian serialization