Hi,
I joined a project where the business objects are being serialized and propagated to other systems. The default java serialization mechanism is used, and thus the slightest change requires the objects to be rebuilt from scratch, since the serialized file is incompatible. The rebuild process is costly and may take up to 6 hours, keeping in mind this is a system that must be up 24/7. It has been the reality for the past few years, but I intend to change that for the better, using Kryo ;)
Now, I'm currently in the process of adding/removing fields (which will invalidate the serialized file) so I want to switch to Kryo altogether. However, it may not be so easy to do everything at once... Just bare with me:
(1) After doing some tests, I believe CompatibleFieldSerializer is what I want (versus TaggedFieldSerializer).
(2) I added new fields in the BOs and marked them as transient (so that the default java implementation still works)
(4) once the BO are loaded from the old serialized file, I will save them back using CompatibleFieldSerializer =>
Unfortunately the new fields are transient and will not be saved.
What would be nice is to be able to specify a custom annotation which would override transient. Thus, the default serialization would work, and then CompatibleFieldSerializer would save the additional fields.
Ex:
@CustomAnnotationToOverrideTransient
private transient int newValue;
Unless such functionality exists (or another way?), the 2 options I see are:
Implement a CustomCompatibleFieldSerializer just to add the CustomAnnotation feature. And then, in a future realease I would change to CompatibleFieldSerializer seemlessly.
OR
Use TaggedFieldSerializer in the next release and only mark the wanted field regardless of whether they are transient or not. Then, switch to CompatibleFieldSerializer in the following release (keeping TaggedFieldSerializer for an initial load then CompatibleFieldSerializer to re-write the whole thing).
Do you see any other blocker? Or other/better options?
--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No I don't need "old code to load newer serialized objects", I need "new code to load old serialized objects and at the same time produce a new serialized format using Kryo".
My understanding is that serializeTransient would either write none or all transient fields. In my case I only want the flag to apply for a couple new fields (other fields are transient and must be ignored).I'm leaning towards writing a custom CompatibleFieldSerializer, which would bypass the transient check when a field is annotated by @NotTransientForKryo. Is that something you would consider to include in your framework ?