kl0u commented on a change in pull request #10311: [FLINK-14762][client] Enrich
JobClient API
URL: https://github.com/apache/flink/pull/10311#discussion_r351136487
##########
File path:
flink-clients/src/main/java/org/apache/flink/client/deployment/ClusterClientJobClientAdapter.java
##########
@@ -86,11 +116,24 @@ public JobID getJobID() {
});
}
+ void addOnCloseActions(Collection<ThrowingRunnable<?>> action) {
+ onCloseActions.addAll(action);
+ }
+
@Override
public void close() throws Exception {
- if (shutdownHook != null) {
- ShutdownHookUtil.removeShutdownHook(shutdownHook,
clusterClient.getClass().getSimpleName(), LOG);
+ Throwable throwable = null;
Review comment:
For whatever reason, `close()` may be called more than once and it should be
idempotent, so I would recommend having a flag in the class, sth like `closed`,
which we will check in the beginning of this method like:
```
if (closed) {
return;
}
closed = true;
...
```
In other case, we risk having junk exceptions being thrown which only
pollute the logs.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services