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


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsConnectionManager.java:
##########
@@ -89,23 +121,56 @@ public ConnectionRequest requestConnection(final HttpRoute 
route,
        */
       @Override
       public HttpClientConnection get(final long timeout,
-          final TimeUnit timeUnit)
-          throws InterruptedException, ExecutionException,
-          ConnectionPoolTimeoutException {
+          final TimeUnit timeUnit) throws ExecutionException {
         String requestId = UUID.randomUUID().toString();
         logDebug("Connection requested for request {}", requestId);
+        if (!route.getTargetHost().equals(baseHost)) {
+          // If the route target host does not match the base host, create a 
new connection
+          logDebug("Route target host {} does not match base host {}, creating 
new connection",
+              route.getTargetHost(), baseHost);
+          return createNewConnection();
+        }
         try {
-          HttpClientConnection clientConn = kac.get();
-          if (clientConn != null) {
-            logDebug("Connection retrieved from KAC: {} for requestId: {}",
-                clientConn, requestId);
-            return clientConn;
+          HttpClientConnection conn = kac.get();
+
+          // If a valid connection is available, return it and trigger 
background warm-up if needed
+          if (conn != null) {
+            triggerConnectionWarmupIfNeeded();
+            return conn;
+          }
+
+          // No connection available — wait up to timeout for one to appear
+          synchronized (connectionLock) {
+            triggerConnectionWarmupIfNeeded();
+
+            final long timeoutMs = 500L;

Review Comment:
   should come from a config 



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