Java serialization allows us to marshal and unmarshal objects. It is a mechanism automatically, at runtime, converts class objects into metadata so instances can be serialized with the least amount of programmer work.
In some of my Java applications, RMI is used quite frequently. Serialization is the mechanism used by RMI to pass objects between JVMs, either as arguments in a method invocation from a client to a server or as return values from a method invocation. In this case, objects are marshalled and unmarshalled a lot between the RMI client and server. Serialization is slow especially for large object since
- Serialization depends on reflection
- Serialization has a verbose data format
- It is easy to send more data than is required
To turn off serialization on a certain field of an object, I tag that field of the class of our object with the Java’s “transient” keyword. This, to low-level parts of the Java virtual machine, is an indication that the transient variable is not part of the persistent state of an object.
Popularity: 1% [?]