[
https://issues.apache.org/jira/browse/FLINK-8916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395013#comment-16395013
]
ASF GitHub Bot commented on FLINK-8916:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/5679#discussion_r173742094
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/CheckpointConfigInfo.java
---
@@ -143,10 +152,66 @@ public int hashCode() {
}
/**
- * Processing mode.
+ * JSON serializer for {@link ProcessingMode}.
*/
+ @JsonSerialize(using = ProcessingModeSerializer.class)
+ @JsonDeserialize(using = ProcessingModeDeserializer.class)
public enum ProcessingMode {
- AT_LEAST_ONCE,
- EXACTLY_ONCE
+ AT_LEAST_ONCE("at_least_once"),
+ EXACTLY_ONCE("exactly_once");
+
+ private String value;
+
+ ProcessingMode(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public static ProcessingMode fromString(String value) {
+ for (ProcessingMode mode : ProcessingMode.values()) {
+ if (mode.value.equalsIgnoreCase(value)) {
+ return mode;
+ }
+ }
+
+ throw new IllegalArgumentException("No constant with
value " + value + " found");
+ }
+
+ }
+
+ /**
+ * JSON deserializer for {@link ProcessingMode}.
+ */
+ public static class ProcessingModeSerializer extends
StdSerializer<ProcessingMode> {
+
+ public ProcessingModeSerializer() {
+ super(ProcessingMode.class);
+ }
+
+ @Override
+ public void serialize(ProcessingMode mode, JsonGenerator
generator, SerializerProvider serializerProvider)
+ throws IOException {
+ generator.writeString(mode.getValue());
+ }
}
+
+ /**
+ * Processing mode deserializer.
+ */
+ public static class ProcessingModeDeserializer extends
StdDeserializer<ProcessingMode> {
+
+ public ProcessingModeDeserializer() {
+ super(ProcessingMode.class);
+ }
+
+ @Override
+ public ProcessingMode deserialize(JsonParser jsonParser,
DeserializationContext deserializationContext)
+ throws IOException {
+ return
ProcessingMode.fromString(jsonParser.getValueAsString());
--- End diff --
replace with
`ProcessingMode.valueOf(jsonParser.getValueAsString.toUpperCase())`
> Checkpointing Mode is always shown to be "At Least Once" in Web UI
> ------------------------------------------------------------------
>
> Key: FLINK-8916
> URL: https://issues.apache.org/jira/browse/FLINK-8916
> Project: Flink
> Issue Type: Bug
> Components: REST
> Affects Versions: 1.5.0, 1.6.0
> Reporter: Gary Yao
> Assignee: vinoyang
> Priority: Blocker
> Labels: flip6
> Fix For: 1.5.0, 1.6.0
>
>
> This only happens in flip6 mode. The {{CheckpointConfigHandler}} returns the
> checkpoint mode uppercased. For example:
> {code}
> {"mode":"EXACTLY_ONCE","interval":5000,"timeout":600000,"min_pause":0,"max_concurrent":1,"externalization":{"enabled":false,"delete_on_cancellation":true}}
> {code}
> However, the Web UI expects the value to be lower cased:
> {code}
> <tr>
> <td>Checkpointing Mode</td>
> <td ng-if="checkpointConfig['mode'] == 'exactly_once'">Exactly
> Once</td>
> <td ng-if="checkpointConfig['mode'] != 'exactly_once'">At Least
> Once</td>
> </tr>
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)