[ 
https://issues.apache.org/jira/browse/HADOOP-19609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18012586#comment-18012586
 ] 

ASF GitHub Bot commented on HADOOP-19609:
-----------------------------------------

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


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsConnectionManager.java:
##########
@@ -201,7 +279,69 @@ public void shutdown() {
 
   private void logDebug(String message, Object... args) {
     if (LOG.isDebugEnabled()) {
-      LOG.debug(message, args);
+      logDebug(message, args);

Review Comment:
   This creates infinite recursion. The method calls itself instead of 
LOG.debug(). This should be 'LOG.debug(message, args);'.
   ```suggestion
         LOG.debug(message, args);
   ```



##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsConnectionManager.java:
##########
@@ -115,6 +180,26 @@ public HttpClientConnection get(final long timeout,
       public boolean cancel() {
         return false;
       }
+
+      /**
+       * Trigger a background warm-up of the connection cache if needed.
+       * This method checks if the cache size is small and if caching is not 
already in progress.
+       * If so, it starts a new thread to cache extra connections.
+       */
+      private void triggerConnectionWarmupIfNeeded() {
+        if (kac.size() <= 2 && !isCaching.get()) {
+          // Use a single-threaded executor or thread pool instead of raw 
thread
+          new Thread(() -> cacheExtraConnection(route, 
cacheRefreshConnections)).start();

Review Comment:
   Creating raw threads is generally discouraged. Consider using a thread pool 
or executor service for better resource management and control.
   ```suggestion
             connectionWarmupExecutor.submit(() -> cacheExtraConnection(route, 
cacheRefreshConnections));
   ```





> ABFS: Apache Client Connection Pool Relook
> ------------------------------------------
>
>                 Key: HADOOP-19609
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19609
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.4.1
>            Reporter: Manish Bhatt
>            Assignee: Manish Bhatt
>            Priority: Major
>              Labels: pull-request-available
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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