You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "rkhachatryan (via GitHub)" <gi...@apache.org> on 2023/02/20 19:10:05 UTC

[GitHub] [flink] rkhachatryan commented on a diff in pull request #21923: FLINK-13871: Consolidate volatile status fields in StreamTask

rkhachatryan commented on code in PR #21923:
URL: https://github.com/apache/flink/pull/21923#discussion_r1112263554


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java:
##########
@@ -256,19 +259,17 @@
     private final StreamTaskAsyncExceptionHandler asyncExceptionHandler;
 
     /**
-     * Flag to mark the task "in operation", in which case check needs to be initialized to true, so
-     * that early cancel() before invoke() behaves correctly.
-     */
-    private volatile boolean isRunning;
-
-    /** Flag to mark this task as canceled. */
-    private volatile boolean canceled;
-
-    /**
-     * Flag to mark this task as failing, i.e. if an exception has occurred inside {@link
-     * #invoke()}.
+     * INITIALIZED: task constructor was called or on init state. RUNNING: task is in operation.
+     * FAILING: task is failing e.g., if an exception has occurred inside {@link #invoke()}.
+     * CANCELED: when this task is canceled. FINISHED: task successfully terminated.
      */
-    private volatile boolean failing;
+    private enum TaskState {
+        INITIALIZED,
+        RUNNING,
+        FAILING,

Review Comment:
   IIRC, it is `failing` and not `failed` to emphasize that the task thread might still be running and hasn't complete the cleanup yet.



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