nzw921rx commented on code in PR #13715:
URL: https://github.com/apache/seatunnel/pull/13715#discussion_r4738935266


##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/TimerFlushWindow.java:
##########
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.engine.common.config;
+
+import org.apache.seatunnel.api.options.EnvCommonOptions;
+
+import java.time.Instant;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.time.format.ResolverStyle;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/** Recurring job-local time window for the Zeta source's flush timer. */
+public final class TimerFlushWindow {
+
+    private static final String KEY = EnvCommonOptions.SINK_FLUSH_WINDOW.key();
+    private static final String START_KEY = 
EnvCommonOptions.SINK_FLUSH_WINDOW_START.key();
+    private static final String END_KEY = 
EnvCommonOptions.SINK_FLUSH_WINDOW_END.key();
+    private static final String ZONE_KEY = 
EnvCommonOptions.SINK_FLUSH_WINDOW_TIMEZONE.key();
+    private static final Object UNSET = new Object();
+    private static final DateTimeFormatter TIME_FORMAT =
+            DateTimeFormatter.ofPattern("HH:mm", Locale.ROOT)
+                    .withResolverStyle(ResolverStyle.STRICT);
+    private static final Set<String> ZONE_IDS = ZoneId.getAvailableZoneIds();
+
+    private final LocalTime start;
+    private final LocalTime end;
+    private final ZoneId zone;
+
+    private TimerFlushWindow(LocalTime start, LocalTime end, ZoneId zone) {
+        this.start = start;
+        this.end = end;
+        this.zone = zone;
+    }
+
+    /** Returns null when the job has no window, or rejects a malformed 
explicit setting. */
+    public static TimerFlushWindow fromEnv(Map<String, Object> env) {
+        if (env == null) {

Review Comment:
   ``` java
   env { 
     job.mode
   }
   ```
   
   The system verifies that this parameter is required, so it will not be empty 
here.



-- 
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]

Reply via email to