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/04/01 09:35:26 UTC

[GitHub] [flink] XComp commented on a change in pull request #19317: [FLINK-26772][runtime] Add flag to prevent job submission in Dispatcher if shutting down

XComp commented on a change in pull request #19317:
URL: https://github.com/apache/flink/pull/19317#discussion_r840403801



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
##########
@@ -167,6 +168,8 @@
     private final ResourceCleaner localResourceCleaner;
     private final ResourceCleaner globalResourceCleaner;
 
+    private final AtomicBoolean shutDown = new AtomicBoolean(false);

Review comment:
       ```suggestion
       private final volatile boolean isShutdown = false;
   ```
   For primitive values like boolean, you could use the `volatile` keyword to mark a member for multi-threaded access. This will prevent the data to be loaded into the Threads stack. Threads will, instead, look it up directly on the heap. This is sufficient for primitive values like boolean, because they are written in a atomic fashion.
   
   An example of such a usage can be found in [ClosingFSDataOutputStream.closed](https://github.com/apache/flink/blob/e0b4cbb5694d9c58f871b79e52da250a2f08cd2a/flink-core/src/main/java/org/apache/flink/core/fs/ClosingFSDataOutputStream.java#L39)




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