bhattmanish98 commented on code in PR #7817:
URL: https://github.com/apache/hadoop/pull/7817#discussion_r2329631985


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsConnectionManager.java:
##########
@@ -192,12 +204,20 @@ public boolean cancel() {
        * If so, it starts a new thread to cache extra connections.
        */
       private void triggerConnectionRefreshIfNeeded() {
-        if (kac.size() <= abfsConfiguration.getApacheMinTriggerRefreshCount()
-            && !isCacheRefreshInProgress.get() && !kac.getIsClosed()) {
+        if (!isCacheRefreshInProgress.get() && !kac.getIsClosed()
+            && kac.getFixedThreadPool() != null
+            && kac.getSingleThreadPool() != null
+            && kac.size()
+            <= abfsConfiguration.getApacheMinTriggerRefreshCount()) {
           // Use a single-threaded executor or thread pool instead of raw 
thread
-          kac.getSingleThreadExecutor().submit(() ->
-              cacheExtraConnection(route,
-                  abfsConfiguration.getApacheCacheRefreshCount()));
+          try {
+            kac.getSingleThreadPool().submit(() ->
+                cacheExtraConnection(route,
+                    abfsConfiguration.getApacheCacheRefreshCount()));
+          } catch (RejectedExecutionException e) {

Review Comment:
   This is intended to prevent the creation of a new connection if the cache 
has already been closed. If a thread tries to access the cache after the cache 
has been closed, a CacheClosed exception will be thrown, so according to the 
design, we should not throw an exception from this point.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to