Since Externalizers are selected by instance, there can arise a situation where an ExternalizerFactory would, for whatever reason, return two different Externalizer instances for two different objects of the same class. Since the externalizer is typically written with the class, and classes are only written one time, the second and subsequent Externalizers will be ignored and the first Externalizer will be used to unmarshal the object on the remote end. This isn't necessarily incorrect; just confusing.
The proper fix would be to introduce a new interface, ClassExternalizerFactory, which has a method:
Externalizer getExternalizer(Class<?> clazz);
Then add a corresponding property to MarshallerConfiguration, and deprecate ExternalizerFactory and its config properties. Then, implementations can prefer the new interface to the old, or even try both. Eventually ExternalizerFactory can then be removed.
Wire protocol should be unaffected by this change.
- relates to
-
JBMAR-29 Remove deprecated ExternalizerFactory interface
- Closed