reswqa commented on code in PR #20229:
URL: https://github.com/apache/flink/pull/20229#discussion_r918116847
##########
flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/core/testutils/CheckedThread.java:
##########
@@ -18,26 +18,42 @@
package org.apache.flink.core.testutils;
+import java.util.concurrent.TimeoutException;
+
/**
* A thread that additionally catches exceptions and offers a joining method
that re-throws the
* exceptions.
*
- * <p>Rather than overriding {@link Thread#run()} (or supplying a {@link
Runnable}), one needs to
- * extends this class and implement the {@link #go()} method. That method may
throw exceptions.
+ * <p>This class needs to supply a {@link RunnableWithException} that may
throw exceptions or
+ * override {@link #go()} method.
+ *
+ * <p>you can use it as the same way of using threads like: {@code new
Thread(Runnable runnable)} or
+ * {@Code new Thread()} and then override {@link Thread#run()} method. Just
change it to {@code new
+ * CheckedThread(RunnableWithException runnableWithException)} or {@Code new
CheckedThread()} and
+ * then override {@link CheckedThread#go()} method.
*
- * <p>Exception from the {@link #go()} method are caught and re-thrown when
joining this thread via
- * the {@link #sync()} method.
+ * <p>Exception from the {@link #runnable} or the override {@link #go()} are
caught and re-thrown
+ * when joining this thread via the {@link #sync()} method.
*/
-public abstract class CheckedThread extends Thread {
+public class CheckedThread extends Thread {
Review Comment:
In addition, I still want to know the clear benefits of removing the
override go method. In my mind, it is more reasonable for us to use
`CheckedThread` like using the `Thread`. When using thread, we usually build it
in two ways: one is pass the runnable object to constructor, and the other is
to override its run method. So the only difference is that the `run` method is
replaced by the `go` method. Previously, `CheckedThread` did not support
constructed by runnable, but now we can complete this function through this pr.
--
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]