This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3b78069b8073ce59dae6173f54b809b65070cde6 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Mon Aug 26 12:00:01 2024 +0200 (chores) camel-http simplify type checks - to use pattern matching for instanceof - use simpler assertion checks --- .../org/apache/camel/component/http/HttpEndpoint.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java index 7385704681b..d6b762eb2ac 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java @@ -641,8 +641,8 @@ public class HttpEndpoint extends HttpCommonEndpoint { @ManagedAttribute(description = "Maximum number of allowed persistent connections") public int getClientConnectionsPoolStatsMax() { ConnPoolControl<?> pool = null; - if (clientConnectionManager instanceof ConnPoolControl) { - pool = (ConnPoolControl<?>) clientConnectionManager; + if (clientConnectionManager instanceof ConnPoolControl<?> connPoolControl) { + pool = connPoolControl; } if (pool != null) { PoolStats stats = pool.getTotalStats(); @@ -656,8 +656,8 @@ public class HttpEndpoint extends HttpCommonEndpoint { @ManagedAttribute(description = "Number of available idle persistent connections") public int getClientConnectionsPoolStatsAvailable() { ConnPoolControl<?> pool = null; - if (clientConnectionManager instanceof ConnPoolControl) { - pool = (ConnPoolControl<?>) clientConnectionManager; + if (clientConnectionManager instanceof ConnPoolControl<?> connPoolControl) { + pool = connPoolControl; } if (pool != null) { PoolStats stats = pool.getTotalStats(); @@ -671,8 +671,8 @@ public class HttpEndpoint extends HttpCommonEndpoint { @ManagedAttribute(description = "Number of persistent connections tracked by the connection manager currently being used to execute requests") public int getClientConnectionsPoolStatsLeased() { ConnPoolControl<?> pool = null; - if (clientConnectionManager instanceof ConnPoolControl) { - pool = (ConnPoolControl<?>) clientConnectionManager; + if (clientConnectionManager instanceof ConnPoolControl<?> connPoolControl) { + pool = connPoolControl; } if (pool != null) { PoolStats stats = pool.getTotalStats(); @@ -687,8 +687,8 @@ public class HttpEndpoint extends HttpCommonEndpoint { + " This can happen only if there are more worker threads contending for fewer connections.") public int getClientConnectionsPoolStatsPending() { ConnPoolControl<?> pool = null; - if (clientConnectionManager instanceof ConnPoolControl) { - pool = (ConnPoolControl<?>) clientConnectionManager; + if (clientConnectionManager instanceof ConnPoolControl<?> connPoolControl) { + pool = connPoolControl; } if (pool != null) { PoolStats stats = pool.getTotalStats();
