You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/17 01:39:46 UTC

[GitHub] [flink] lincoln-lil commented on a diff in pull request #19983: [FLINK-27878][datastream] Add Retry Support For Async I/O In DataStream API

lincoln-lil commented on code in PR #19983:
URL: https://github.com/apache/flink/pull/19983#discussion_r899684838


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/util/retryable/RetryPredicates.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.util.retryable;
+
+import javax.annotation.Nonnull;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.function.Predicate;
+
+/** Utility class to create concrete retry predicates. */
+public class RetryPredicates {
+
+    /** A predicate matches empty result which means an empty {@link Collection}. */
+    public static final EmptyResultPredicate EMPTY_RESULT_PREDICATE = new EmptyResultPredicate();
+
+    /** A predicate matches any exception which means a non-null{@link Throwable}. */
+    public static final HasExceptionPredicate HAS_EXCEPTION_PREDICATE = new HasExceptionPredicate();
+
+    /**
+     * Create a predicate on given exception type.
+     *
+     * @param exceptionClass
+     * @return predicate on exception type.
+     */
+    public static ExceptionTypePredicate createExceptionTypePredicate(
+            @Nonnull Class<? extends Throwable> exceptionClass) {
+        return new ExceptionTypePredicate(exceptionClass);
+    }
+
+    public static ExceptionTypePredicate exceptionTypePredicate(

Review Comment:
   Good catch! This candidate method is discarded, I'll remove it. Thanks for your reviewing!



-- 
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-unsubscribe@flink.apache.org

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