Skip to content
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

Add create method with metrics parameter in ConnectionProvider (#2313) #2314

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions reactor-netty-core/build.gradle
Expand Up @@ -194,6 +194,9 @@ task japicmp(type: JapicmpTask) {
ignoreMissingClasses = true
includeSynthetic = true
onlyIf { "$compatibleVersion" != "SKIP" }
methodExcludes = [
"reactor.netty.resources.ConnectionProvider#create(java.lang.String, int, boolean)"
]
}

tasks.japicmp.dependsOn(downloadBaseline)
Expand Down
Expand Up @@ -161,6 +161,29 @@ static ConnectionProvider create(String name, int maxConnections) {
.build();
}

/**
* Create a new {@link ConnectionProvider} to cache and reuse a fixed maximum
* number of {@link Connection}.
* <p>A Fixed {@link ConnectionProvider} will open up to the given max connection value.
* Further connections will be pending acquisition until {@link #DEFAULT_POOL_ACQUIRE_TIMEOUT}
* and the default pending acquisition max count will be 2 * max connections value.
*
* @param name the connection pool name
* @param maxConnections the maximum number of connections before starting pending
* acquisition on existing ones
* @param metricsEnabled true enables metrics collection; false disables it
*
* @return a new {@link ConnectionProvider} to cache and reuse a fixed maximum
* number of {@link Connection}
tuguri8 marked this conversation as resolved.
Show resolved Hide resolved
* @since 1.0.21
*/
static ConnectionProvider create(String name, int maxConnections, boolean metricsEnabled) {
return builder(name).maxConnections(maxConnections)
.pendingAcquireTimeout(Duration.ofMillis(DEFAULT_POOL_ACQUIRE_TIMEOUT))
.metrics(metricsEnabled)
.build();
}

/**
* Return an existing or new {@link Connection} on subscribe.
*
Expand Down