Devs,

Please be careful with how you are serializing internal classes between servers 
and clients. While you may think you are safe if you simply use 
DataSerializable you are wrong, very very wrong. If you define your internal 
class as DataSerializable then when serialized the fully qualified class name 
is serialized ahead of it to identify the class being serialized. This happens 
because there is no Instantiator for your internal class, so it can’t use a 
number and falls back to the class name. If you rename or move the class later 
you will run into backwards compatibility issues that have to be resolved by 
transforming the string name back and forth to the new name. 

DataSerializable should be reserved only for user defined classes. Please use 
DataSerializableFixedID for internal classes. This method uses a fixed integer 
to identify your class. Not only is it more efficient it also avoids issues 
with class or package renaming. 

Thanks,
Jake

Reply via email to