Skip to content

Commit

Permalink
Add create method with metrics parameter in ConnectionProvider (#2314)
Browse files Browse the repository at this point in the history
Fixes #2313
  • Loading branch information
tuguri8 committed Jun 23, 2022
1 parent c46d305 commit 3a9fcc0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
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}
* @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

0 comments on commit 3a9fcc0

Please sign in to comment.