Repository: apache/hadoop
File: hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsApacheHttpClient.java (Java)

Code before:
  /**
   * @return if ApacheHttpClient is usable.
   */
  static boolean usable() {
    return usable;
  }

  AbfsApacheHttpClient(DelegatingSSLSocketFactory delegatingSSLSocketFactory,
      final AbfsConfiguration abfsConfiguration,
      final KeepAliveCache keepAliveCache,
      URL baseUrl,
      final boolean isCacheWarmupNeeded) {
    final AbfsConnectionManager connMgr = new AbfsConnectionManager(
        createSocketFactoryRegistry(
            new SSLConnectionSocketFactory(delegatingSSLSocketFactory,
                getDefaultHostnameVerifier())),
        new AbfsHttpClientConnectionFactory(), keepAliveCache,
        abfsConfiguration, baseUrl, isCacheWarmupNeeded);
    final HttpClientBuilder builder = HttpClients.custom();
    builder.setConnectionManager(connMgr)
        .setRequestExecutor(
            new AbfsManagedHttpRequestExecutor(
                abfsConfiguration.getHttpReadTimeout()))
        .disableContentCompression()
        .disableRedirectHandling()
        .disableAutomaticRetries()
        /*
         * To prevent the read of system property http.agent. The agent is set
         * in request headers by AbfsClient. System property read is an
         * overhead.
         */
        .setUserAgent(EMPTY_STRING);
    httpClient = builder.build();
  }

  @Override
  public void close() throws IOException {
    if (httpClient != null) {
      httpClient.close();
    }
  }

  /**
   * Executes the HTTP request.
   *
   * @param httpRequest HTTP request to execute.
   * @param abfsHttpClientContext HttpClient context.
   * @param connectTimeout Connection timeout.
   * @param readTimeout Read timeout.
   *
   * @return HTTP response.

Review comment (suggestion):
As we were discussing last time, if we keep it to read timeout the 100 continue timeout would become 30 seconds, this should be another config for 100 continue timeout

Code after:
  /**
   * @return if ApacheHttpClient is usable.
   */
  static boolean usable() {
    return usable;
  }

  AbfsApacheHttpClient(DelegatingSSLSocketFactory delegatingSSLSocketFactory,
      final AbfsConfiguration abfsConfiguration,
      final KeepAliveCache keepAliveCache,
      URL baseUrl,
      final boolean isCacheWarmupNeeded) {
    final AbfsConnectionManager connMgr = new AbfsConnectionManager(
        createSocketFactoryRegistry(
            new SSLConnectionSocketFactory(delegatingSSLSocketFactory,
                getDefaultHostnameVerifier())),
        new AbfsHttpClientConnectionFactory(), keepAliveCache,
        abfsConfiguration, baseUrl, isCacheWarmupNeeded);
    final HttpClientBuilder builder = HttpClients.custom();
    builder.setConnectionManager(connMgr)
        .setRequestExecutor(
            // In case of Expect:100-continue, the timeout for waiting for
            // the 100-continue response from the server is set using
            // ExpectWaitContinueTimeout. For other requests, the read timeout
            // is set using SocketTimeout.
            new AbfsManagedHttpRequestExecutor(
                abfsConfiguration.isExpectHeaderEnabled()
                    ? abfsConfiguration.getExpect100ContinueWaitTimeout()
                    : abfsConfiguration.getHttpReadTimeout()))
        .disableContentCompression()
        .disableRedirectHandling()
        .disableAutomaticRetries()
        /*
         * To prevent the read of system property http.agent. The agent is set
         * in request headers by AbfsClient. System property read is an
         * overhead.
         */
        .setUserAgent(EMPTY_STRING);
    httpClient = builder.build();
  }

  @Override
  public void close() throws IOException {
    if (httpClient != null) {
      httpClient.close();
    }
  }

  /**
   * Executes the HTTP request.
   *