...
Solution
The proposed solution includes introducing a new Service Provider Interface (SPI) - DSFIDLoader
- to the geode-serialization
module. This SPI will be initialized as part of the static class initialization already existing in InternalDataSerializer
.has 2 parts:
Currently, the DSFIDSerializer
interface exposes a registerDSFID(int dsfid, Class<?> dsfidClass)
method. This method will be moved into a new interface ( DataSerializerFixedIdRegistrant
) and DSFIDSerialzer
will extend this interface:
Code Block | ||||
---|---|---|---|---|
| ||||
interface DataSerializeableFixedIdRegistry {
register(int id, Class<? extends DataSerializableFixedId> clazz);
} |
This will reduce the API surface area required by the following new service provider interface which would perform the actual Fixed Id registration:
Code Block | ||||
---|---|---|---|---|
| ||||
public interface DSFIDLoaderDataSerializeableFixedIdRegistrant { void registerDSFIDsregister(DSFIDSerializerDataSerializableFixedIdRegistry serializerregistry); } |
This SPI will be initialized as part of the static class initialization already existing in InternalDataSerializer
.
In order to use this, a module will need to:
- Include a provider configuration resource file:
resources/META-INF/services/org.apache.geode.internal.serialization.DSFIDLoader
DataSerializabledFixedIdRegistrant
- This file will contain one or more fully qualified class names which implement the above interface
...