diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/metrics/flink/CheckPoints.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/metrics/flink/CheckPoints.java index f34ac65b45..b25bbdbe41 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/metrics/flink/CheckPoints.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/metrics/flink/CheckPoints.java @@ -17,8 +17,8 @@ package org.apache.streampark.console.core.metrics.flink; -import org.apache.streampark.console.core.enums.CheckPointStatusEnum; -import org.apache.streampark.console.core.enums.CheckPointTypeEnum; +import org.apache.streampark.console.core.enums.CheckPointStatus; +import org.apache.streampark.console.core.enums.CheckPointType; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -29,100 +29,97 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Objects; @Getter @Setter public class CheckPoints implements Serializable { - private List history; + private List history; - private Latest latest; + private Latest latest; - @JsonIgnore - public List getLatestCheckpoint() { - if (Objects.isNull(latest)) { - return Collections.emptyList(); - } - return latest.getLatestCheckpoint(); + @JsonIgnore + public List getLatestCheckpoint() { + if (latest == null) { + return Collections.emptyList(); } + return latest.getLatestCheckpoint(); + } - @Getter - @Setter - public static class CheckPoint implements Serializable { - - private Long id; - private String status; + @Getter + @Setter + public static class CheckPoint implements Serializable { + private Long id; + private String status; - @JsonProperty("external_path") - private String externalPath; + @JsonProperty("external_path") + private String externalPath; - @JsonProperty("is_savepoint") - private Boolean isSavepoint; + @JsonProperty("is_savepoint") + private Boolean isSavepoint; - @JsonProperty("latest_ack_timestamp") - private Long latestAckTimestamp; + @JsonProperty("latest_ack_timestamp") + private Long latestAckTimestamp; - @JsonProperty("checkpoint_type") - private String checkpointType; + @JsonProperty("checkpoint_type") + private String checkpointType; - @JsonProperty("trigger_timestamp") - private Long triggerTimestamp; + @JsonProperty("trigger_timestamp") + private Long triggerTimestamp; - @JsonProperty("state_size") - private Long stateSize; + @JsonProperty("state_size") + private Long stateSize; - @JsonProperty("end_to_end_duration") - private Long endToEndDuration; + @JsonProperty("end_to_end_duration") + private Long endToEndDuration; - private Boolean discarded; + private Boolean discarded; - public CheckPointStatusEnum getCheckPointStatus() { - return CheckPointStatusEnum.valueOf(this.status); - } + public CheckPointStatus getCheckPointStatus() { + return CheckPointStatus.valueOf(this.status); + } - public CheckPointTypeEnum getCheckPointType() { - if ("CHECKPOINT".equals(this.checkpointType)) { - return CheckPointTypeEnum.CHECKPOINT; - } - if ("SAVEPOINT".equals(this.checkpointType)) { - return CheckPointTypeEnum.SAVEPOINT; - } - return CheckPointTypeEnum.SYNC_SAVEPOINT; - } + public CheckPointType getCheckPointType() { + if ("CHECKPOINT".equals(this.checkpointType)) { + return CheckPointType.CHECKPOINT; + } else if ("SAVEPOINT".equals(this.checkpointType)) { + return CheckPointType.SAVEPOINT; + } + return CheckPointType.SYNC_SAVEPOINT; + } - public String getPath() { - return this.getExternalPath().replaceFirst("^hdfs:/[^/]", "hdfs:///"); - } + public String getPath() { + return this.getExternalPath().replaceFirst("^hdfs:/[^/]", "hdfs:///"); } + } + + @Getter + @Setter + public static class Latest implements Serializable { - @Getter - @Setter - public static class Latest implements Serializable { - - private CheckPoint completed; - private CheckPoint savepoint; - private CheckPoint failed; - - @JsonIgnore - public List getLatestCheckpoint() { - List checkPoints = new ArrayList<>(); - if (completed != null) { - checkPoints.add(completed); - } - if (savepoint != null) { - checkPoints.add(savepoint); - } - if (failed != null) { - if (completed == null) { - checkPoints.add(failed); - } else { - if (failed.getId() > completed.getId()) { - checkPoints.add(failed); - } - } - } - return checkPoints; + private CheckPoint completed; + private CheckPoint savepoint; + private CheckPoint failed; + + @JsonIgnore + public List getLatestCheckpoint() { + List checkPoints = new ArrayList<>(); + if (completed != null) { + checkPoints.add(completed); + } + if (savepoint != null) { + checkPoints.add(savepoint); + } + if (failed != null) { + if (completed == null) { + checkPoints.add(failed); + } else { + if (failed.getId() > completed.getId()) { + checkPoints.add(failed); + } } + } + return checkPoints; } + } }