-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration for setting maximum number of connection pools to be created #3566
base: main
Are you sure you want to change the base?
Configuration for setting maximum number of connection pools to be created #3566
Conversation
…nnection pools a ConnectionProvider should create. Once the expected number is exceeded, a warning message is logged.
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jchenga Thanks for the PR!
I do have some suggestions for the name of the new API and for the tests.
reactor-netty-core/src/main/java/reactor/netty/resources/ConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-core/src/main/java/reactor/netty/resources/ConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-core/src/main/java/reactor/netty/resources/ConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-core/src/main/java/reactor/netty/resources/ConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-core/src/main/java/reactor/netty/resources/PooledConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-core/src/main/java/reactor/netty/resources/PooledConnectionProvider.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
…pClientTest.java Co-authored-by: Violeta Georgieva <[email protected]>
f64e1cd
to
e3e5578
Compare
e3e5578
to
420dd1c
Compare
I have made the suggested changes. |
/** | ||
* Specifies the maximum number of connection pools that the provider can create. | ||
* If the number of connection pools created exceeds this value, a warning message is logged. | ||
* The value must be positive or zero; otherwise, the connection pools check is ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to allow this value to be set to 0
? If one doesn't want pooling, one can disable the pooling.
* @return the current {@link Builder} instance with the updated configuration. | ||
*/ | ||
public Builder maxConnectionPools(int maxConnectionPools) { | ||
this.maxConnectionPools = maxConnectionPools; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a check for the provided value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the user to be able to reset this to -1
? For example:
reactor-netty/reactor-netty-core/src/main/java/reactor/netty/resources/ConnectionProvider.java
Lines 585 to 602 in 11f91b0
/** | |
* Set the options to use for configuring {@link ConnectionProvider} the maximum number of registered | |
* requests for acquire to keep in a pending queue | |
* When invoked with -1 the pending queue will not have upper limit. | |
* Default to {@code 2 * max connections}. | |
* | |
* @param pendingAcquireMaxCount the maximum number of registered requests for acquire to keep | |
* in a pending queue | |
* @return {@literal this} | |
* @throws IllegalArgumentException if pendingAcquireMaxCount is negative | |
*/ | |
public final SPEC pendingAcquireMaxCount(int pendingAcquireMaxCount) { | |
if (pendingAcquireMaxCount != -1 && pendingAcquireMaxCount <= 0) { | |
throw new IllegalArgumentException("Pending acquire max count must be strictly positive"); | |
} | |
this.pendingAcquireMaxCount = pendingAcquireMaxCount; | |
return get(); | |
} |
} | ||
} | ||
finally { | ||
disposableServer.dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's dispose the ConnectionProvider
here.
No need to dispose the server it will be disposed by reactor.netty.BaseHttpTest#disposeServer
Introduce a configuration option to specify the maximum number of connection pools a
ConnectionProvider
should create. Once the maximum number is exceeded, a warning message is logged.Fixes #3318.