reiabreu opened a new pull request, #8452:
URL: https://github.com/apache/storm/pull/8452
> [!IMPORTANT]
> Disclaimer: This PR and its description were generated using Gemini CLI,
an AI-powered developer tool.
Problem Statement
Currently, the IKryoDecorator interface only provides access to the Kryo
instance. This prevents users from registering custom serializers that require
metadata or schemas stored in the topology configuration. Users were previously
forced to use brittle workarounds, such as reading configuration from the
local filesystem at worker startup.
Proposed Changes
This PR updates the IKryoDecorator interface to provide access to the
topology configuration map, allowing for more dynamic and configuration-driven
serialization logic.
1. Interface Evolution (IKryoDecorator.java):
* Added a new default method: void decorate(Kryo k, Map<String,
Object> conf).
* Deprecated the legacy void decorate(Kryo k) method.
* The new method calls the deprecated one by default to maintain
source and binary compatibility for existing implementations.
2. Serialization Logic Update (SerializationFactory.java):
* Updated the getKryo factory method to pass the topology
configuration (conf) when invoking decorators.
3. Testing and Validation:
* Added a new test case test_registers_decorator_with_conf to
SerializationFactoryTest.java.
* Verified that a custom decorator can successfully retrieve values
from the configuration map to perform conditional registrations.
Backward Compatibility
* Binary Compatibility: Existing compiled decorators will continue to
work without modification as the new method is a Java default method.
* Source Compatibility: Existing source code will compile without
changes, although users will receive a deprecation warning if they continue to
implement the single-parameter decorate method.
Verification Results
* Ran mvn test -Dtest=SerializationFactoryTest -pl storm-client — SUCCESS
* Verified that TestKryoDecorator.java (using the old signature) still
functions as expected.
* Verified that Javadoc meets project Checkstyle requirements.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]