ryanvanhuuksloot commented on code in PR #21077:
URL: https://github.com/apache/flink/pull/21077#discussion_r1000885089


##########
flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/async/AsyncRetryStrategies.scala:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.flink.streaming.api.scala.async
+
+import java.util
+import java.util.function.Predicate
+
+object AsyncRetryStrategies {
+
+  class RetryPredicate[OUT](

Review Comment:
   This should be private



##########
flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/async/AsyncRetryStrategies.scala:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.flink.streaming.api.scala.async
+
+import java.util
+import java.util.function.Predicate
+
+object AsyncRetryStrategies {
+

Review Comment:
   Can you add a `NoRetryStrategy` like the java version.



##########
flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/async/AsyncRetryStrategies.scala:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.flink.streaming.api.scala.async
+
+import java.util
+import java.util.function.Predicate
+
+object AsyncRetryStrategies {
+
+  class RetryPredicate[OUT](
+      final val resultPredicate: Option[Predicate[util.Collection[OUT]]],
+      final val exceptionPredicate: Option[Predicate[Throwable]])
+    extends AsyncRetryPredicate[OUT]
+
+  @SerialVersionUID(1L)
+  class FixedDelayRetryStrategy[OUT](
+      private val maxAttempts: Int,
+      private val backoffTimeMillis: Long,
+      private val resultPredicate: Option[Predicate[util.Collection[OUT]]],
+      private val exceptionPredicate: Option[Predicate[Throwable]]
+  ) extends AsyncRetryStrategy[OUT] {
+    override def canRetry(currentAttempts: Int): Boolean = currentAttempts <= 
maxAttempts
+
+    override def getBackoffTimeMillis(currentAttempts: Int): Long = {
+      backoffTimeMillis
+    }
+
+    override def getRetryPredicate(): AsyncRetryPredicate[OUT] =
+      new RetryPredicate(resultPredicate, exceptionPredicate)
+  }
+
+  @SerialVersionUID(1L)
+  class FixedDelayRetryStrategyBuilder[OUT](
+      private val maxAttempts: Int,
+      private val backoffTimeMillis: Long
+  ) {
+    private var resultRetryPredicate: Option[Predicate[util.Collection[OUT]]] 
= None

Review Comment:
   Add argument checking like java (MaxAttempts and backoffTimeMillis > 0)



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to