<commit_before>== Connection Pool
By default, `HttpClient` uses a "`fixed`" connection pool with `500` as the maximum number of active channels
and `1000` as the maximum number of further channel acquisition attempts allowed to be kept in a pending state
(for the rest of the configurations check the system properties or the builder configurations below).
This means that the implementation creates a new channel if someone tries to acquire a channel
as long as less than `500` have been created and are managed by the pool.
When the maximum number of channels in the pool is reached, up to `1000` new attempts to
acquire a channel are delayed (pending) until a channel is returned to the pool again,
and further attempts are declined with an error.

====
[source,java,indent=0]
../../../reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java
----
include::./../../reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java[lines=117..159]
----
====

When you need to change the default settings, you can configure the `ConnectionProvider` as follows:

====
[source,java,indent=0]
.{examplesdir}/pool/config/Application.java
----
include::{examplesdir}/pool/config/Application.java[lines=18..50]
----
<1> Configures the maximum time for a connection to stay idle to 20 seconds.
<2> Configures the maximum time for a connection to stay alive to 60 seconds.
<3> Configures the maximum time for the pending acquire operation to 60 seconds.
<4> Every two minutes, the connection pool is regularly checked for connections that are applicable for removal.
====

The following listing shows the available configurations:
[width="100%",options="header"]
|=======
| Configuration name | Description
| `disposeInactivePoolsInBackground` | When this option is enabled, connection pools are regularly checked in the background,
and those that are empty and been inactive for a specified time become eligible for disposal. By default, this background
disposal of inactive pools is disabled.
| `disposeTimeout` | When `ConnectionProvider#dispose()` or `ConnectionProvider#disposeLater()` is called,
trigger a graceful shutdown for the connection pools, with this grace period timeout.
From there on, all calls for acquiring a connection will fail fast with an exception.
However, for the provided `Duration`, pending acquires will get a chance to be served.
Note: The rejection of new acquires and the grace timer start immediately,
irrespective of subscription to the `Mono` returned by `ConnectionProvider#disposeLater()`.<commit_msg>[doc] Provide more clarity of `maxConnections` usage (#2059)<commit_after>== Connection Pool
By default, `HttpClient` uses a "`fixed`" connection pool with `500` as the maximum number of active channels
and `1000` as the maximum number of further channel acquisition attempts allowed to be kept in a pending state
(for the rest of the configurations check the system properties or the builder configurations below).
This means that the implementation creates a new channel if someone tries to acquire a channel
as long as less than `500` have been created and are managed by the pool.
When the maximum number of channels in the pool is reached, up to `1000` new attempts to
acquire a channel are delayed (pending) until a channel is returned to the pool again,
and further attempts are declined with an error.

====
[source,java,indent=0]
../../../reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java
----
include::./../../reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java[lines=117..159]
----
====

When you need to change the default settings, you can configure the `ConnectionProvider` as follows:

====
[source,java,indent=0]
.{examplesdir}/pool/config/Application.java
----
include::{examplesdir}/pool/config/Application.java[lines=18..50]
----
<1> Configures the maximum time for a connection to stay idle to 20 seconds.
<2> Configures the maximum time for a connection to stay alive to 60 seconds.
<3> Configures the maximum time for the pending acquire operation to 60 seconds.
<4> Every two minutes, the connection pool is regularly checked for connections that are applicable for removal.
====

NOTE: Notice that only the default `HttpClient` (`HttpClient.create()`) uses `500` as the maximum number of active channels. In the example above, when
instantiating a custom `ConnectionProvider`, we are changing this value to `50` using `maxConnections`. Also, if you don't set this parameter the
default `maxConnections` is used (2 * available number of processors).

The following listing shows the available configurations:
[width="100%",options="header"]
|=======
| Configuration name | Description
| `disposeInactivePoolsInBackground` | When this option is enabled, connection pools are regularly checked in the background,
and those that are empty and been inactive for a specified time become eligible for disposal. By default, this background
disposal of inactive pools is disabled.
| `disposeTimeout` | When `ConnectionProvider#dispose()` or `ConnectionProvider#disposeLater()` is called,
trigger a graceful shutdown for the connection pools, with this grace period timeout.
From there on, all calls for acquiring a connection will fail fast with an exception.
However, for the provided `Duration`, pending acquires will get a chance to be served.
Note: The rejection of new acquires and the grace timer start immediately,
irrespective of subscription to the `Mono` returned by `ConnectionProvider#disposeLater()`.
{'fraction_non_alphanumeric': 0.08462238398544131, 'fraction_numerical': 0.016014558689717927, 'mean_word_length': 5.066225165562914, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4032508', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1334, 'n_words': 708}