rishabhdaim commented on code in PR #1456:
URL: https://github.com/apache/jackrabbit-oak/pull/1456#discussion_r1599864900


##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedMongoDownloadTask.java:
##########
@@ -441,23 +441,24 @@ private void downloadWithRetryOnConnectionErrors() throws 
InterruptedException,
                 // One of the download tasks finished with an exception. 
Cancel the other one. Trying to cancel the
                 // task that already failed has no effect
                 LOG.info("Error during download. Canceling download threads. 
Error: {}", e.toString());
-                ascendingDownloadFuture.cancel(true);
-                descendingDownloadFuture.cancel(true);
+                downloadThreadPool.shutdownNow();
                 throw new RuntimeException(e);
             } catch (InterruptedException e) {
                 LOG.info("Thread interrupted. Cancelling download threads.");
                 // The parent thread was interrupted. Shutdown the download 
threads.
-                ascendingDownloadFuture.cancel(true);
-                descendingDownloadFuture.cancel(true);
+                downloadThreadPool.shutdownNow();

Review Comment:
   I would reuse the existing class 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/concurrent/ExecutorCloser.java
 to close this executor.
   
   Sample usage can be found here 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStoreThrottlingMetricsUpdater.java#L121



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to