yanghua commented on a change in pull request #6430: [FLINK-8058][Queryable
State]Queryable state should check types
URL: https://github.com/apache/flink/pull/6430#discussion_r205753939
##########
File path:
flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java
##########
@@ -264,4 +269,39 @@
return null;
}
}
+
+ /**
+ * Serialize a stateDescriptor to bytes[].
+ * @param stateDescriptor the value will be serialized.
+ *
+ * @return The serialized values
+ * @throws IOException On failure during serialization
+ */
+ public static byte[] serializedStateDescriptor(StateDescriptor<?, ?>
stateDescriptor) throws IOException {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bos);
+ out.writeObject(stateDescriptor);
+ out.close();
Review comment:
shall we use `try-with-resource` to make sure the stream can be closed?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services