开发者

EHCache And Java Serialization Versioning Control

开发者 https://www.devze.com 2023-01-10 12:03 出处:网络
EHCache allows for persistance of the cache, and it requires all objects that are being cached to be Serializable. The objects that are being serialized and written to the Diskare being written with O

EHCache allows for persistance of the cache, and it requires all objects that are being cached to be Serializable. The objects that are being serialized and written to the Disk are being written with ObjectOutputStream开发者_开发技巧, which is fixed in its required fields and UID. link text

My question is: Is there a way to force the serialization [i.e. overwritting writeObject] to force an non-fixed/versioned way? [i.e. protocol buffers, xml, etc]


ObjectOutputStream, which is fixed in its required fields and UID.

No it isn't. It requires a fixed serialVersionUID all right, but it has a lot of flexibility about how much versioning it can support - see the Versioning chapter of the Object Serialization Specification.

0

精彩评论

暂无评论...
验证码 换一张
取 消