curcur commented on a change in pull request #12525:
URL: https://github.com/apache/flink/pull/12525#discussion_r441261520



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -611,27 +611,21 @@ protected void cleanUpInvoke() throws Exception {
                Thread.interrupted();
 
                // stop all timers and threads
-               tryShutdownTimerService();
+               Exception suppressedException = 
suppressThrowable(this::tryShutdownTimerService, null);
 
                // stop all asynchronous checkpoint threads
-               try {
-                       cancelables.close();
-                       shutdownAsyncThreads();
-               } catch (Throwable t) {
-                       // catch and log the exception to not replace the 
original exception
-                       LOG.error("Could not shut down async checkpoint 
threads", t);
-               }
+               suppressedException = suppressThrowable(cancelables::close, 
suppressedException);
+               suppressedException = 
suppressThrowable(this::shutdownAsyncThreads, suppressedException);
 
                // we must! perform this cleanup
-               try {
-                       cleanup();
-               } catch (Throwable t) {
-                       // catch and log the exception to not replace the 
original exception
-                       LOG.error("Error during cleanup of stream task", t);
-               }
+               suppressedException = suppressThrowable(this::cleanup, 
suppressedException);
 
                // if the operators were not disposed before, do a hard dispose
-               disposeAllOperators(true);
+               try {
+                       disposeAllOperators();
+               } catch (Exception t) {
+                       suppressedException = 
ExceptionUtils.firstOrSuppressed(t, suppressedException);

Review comment:
       Yeah, that's my first intention as well: I was thinking of using 
`suppressThrowable` here.
   
   However, remember that we decide to catch `Exception` instead of `Throwable` 
during sync up with @pnowojski
   
   But I think it is no harm to change to `Throwable`




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to