zentol commented on code in PR #21056:
URL: https://github.com/apache/flink/pull/21056#discussion_r996942242
##########
flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java:
##########
@@ -756,7 +811,27 @@ public GlobalJobParameters getGlobalJobParameters() {
*/
public void setGlobalJobParameters(GlobalJobParameters
globalJobParameters) {
Preconditions.checkNotNull(globalJobParameters, "globalJobParameters
shouldn't be null");
- this.globalJobParameters = globalJobParameters;
+ configuration.set(
+ GLOBAL_JOB_PARAMETERS_EXECUTION_CONFIG,
convertToString(globalJobParameters));
+ }
+
+ private static String convertToString(final Serializable object) {
+ try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+ oos.writeObject(object);
+ return Base64.getEncoder().encodeToString(baos.toByteArray());
+ } catch (final IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private static <T extends Serializable> T convertFrom(final String
objectAsString) {
+ final byte[] data = Base64.getDecoder().decode(objectAsString);
+ try (final ObjectInputStream ois = new ObjectInputStream(new
ByteArrayInputStream(data))) {
+ return (T) ois.readObject();
Review Comment:
sounds good to me. (I also don't see a good alternative :see_no_evil: )
--
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]