xintongsong commented on a change in pull request #18935: URL: https://github.com/apache/flink/pull/18935#discussion_r817312657
########## File path: flink-rpc/flink-rpc-core/src/main/java/org/apache/flink/runtime/rpc/messages/RemoteRpcInvocation.java ########## @@ -108,129 +105,185 @@ public String toString() { // ------------------------------------------------------------------- private void writeObject(ObjectOutputStream oos) throws IOException { - oos.writeUTF(declaringClassName); - oos.writeUTF(methodName); + // Translate it to byte array so that we can deserialize classes which cannot be found in + // akka class loader. + byte[] bytes = InstantiationUtil.serializeObject(methodInvocation); + oos.writeObject(bytes); + } + + @SuppressWarnings("unchecked") + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + byte[] bytes = (byte[]) ois.readObject(); + methodInvocation = + InstantiationUtil.deserializeObject(bytes, ClassLoader.getSystemClassLoader()); + } + + // ------------------------------------------------------------------- + // Utility classes + // ------------------------------------------------------------------- + + /** Wrapper class for the method invocation information. */ + private static final class MethodInvocation implements Serializable { + private static final long serialVersionUID = 9187962608946082519L; Review comment: ```suggestion private static final long serialVersionUID = 1L; ``` ########## File path: flink-rpc/flink-rpc-core/src/main/java/org/apache/flink/runtime/rpc/messages/RemoteRpcInvocation.java ########## @@ -108,129 +105,185 @@ public String toString() { // ------------------------------------------------------------------- private void writeObject(ObjectOutputStream oos) throws IOException { - oos.writeUTF(declaringClassName); - oos.writeUTF(methodName); + // Translate it to byte array so that we can deserialize classes which cannot be found in + // akka class loader. + byte[] bytes = InstantiationUtil.serializeObject(methodInvocation); + oos.writeObject(bytes); + } + + @SuppressWarnings("unchecked") Review comment: ```suggestion ``` -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org