X-czh commented on code in PR #26461:
URL: https://github.com/apache/flink/pull/26461#discussion_r2044309986


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java:
##########
@@ -426,11 +431,7 @@ public T deserialize(DataInputView source) throws 
IOException {
 
         if ((flags & IS_SUBCLASS) != 0) {
             String subclassName = source.readUTF();
-            try {
-                actualSubclass = Class.forName(subclassName, true, cl);
-            } catch (ClassNotFoundException e) {
-                throw new RuntimeException("Cannot instantiate class.", e);
-            }
+            actualSubclass = getSubclassByName(subclassName);

Review Comment:
   1. Classloader: The same context classloader (stored in variable `cl`) is 
used within the same serializer instance here, so this should not be an issue 
here.
   2. It is possible, though not quite likely. Similar issues apply to the 
existing `subclassSerializerCache` as well, a potential improvement is to 
hardcode a capacity limit or use some capacity-limited cache impl like the 
Gauva cache.
   3. For UT, the correctness is already covered by the existing 
`PojoSubclassSerializerTest`; for performance, a new benchmark is more suited, 
and I plan to add it in 
[FLINK-37681](https://issues.apache.org/jira/browse/FLINK-37681)



-- 
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]

Reply via email to