akalash commented on code in PR #21923: URL: https://github.com/apache/flink/pull/21923#discussion_r1120298423
########## flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java: ########## @@ -1019,16 +1049,24 @@ public CanEmitBatchOfRecordsChecker getCanEmitBatchOfRecords() { return () -> !this.mailboxProcessor.hasMail() && taskIsAvailable(); } + public final boolean isInitialized() { Review Comment: I'm not sure that we need these new methods(especially as public) considering that right now nobody uses them. Maybe it makes sense to create some method in the TaskState like `taskState.isStatus(RUNNING)`. But at least we should avoid public methods which we don't need. ########## flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java: ########## @@ -255,23 +258,52 @@ 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 the task at restoring duration in {@link #restore()}. */ - private volatile boolean isRestoring; - - /** Flag to mark this task as canceled. */ - private volatile boolean canceled; + /** Possible states of a Task. */ + private static class TaskState { Review Comment: Maybe is it better to put the inner class at the bottom of this class? -- 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