简体   繁体   English

httpClient连接池管理器validateAfterInactivity

[英]httpClient connection pool manager validateAfterInactivity

I am looking at the documentation of PoolingHttpClientConnectionManager https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html 我正在查看PoolingHttpClientConnectionManager的文档https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html

There is an API setValidateAfterInactivity. 有一个API setValidateAfterInactivity。 validateAfterInactivity is not very clear to me. validateAfterInactivity对我来说不是很清楚。 It says - "Defines period of inactivity in milliseconds after which persistent connections must be re-validated prior to being leased to the consumer" 它说 - “定义不活动的时间段,以毫秒为单位,之后必须重新验证持久连接,然后再租给消费者”

How exactly does it re-validate the connection? 它是如何重新验证连接的呢? Wanted to understand the process. 想要了解这个过程。 Does it send any http request to server or something to re-validate, or its something else? 它是否向服务器发送任何http请求或重新验证的内容,或其他内容?

What is the criteria/mechanism it uses to revalidate the connection? 它用于重新验证连接的标准/机制是什么? How does it all work? 它是怎么运行的?

It use JDBC connection to do validate. 它使用JDBC连接来进行验证。

                    final ManagedHttpClientConnection conn = poolEntry.getConnection();
                    if (conn != null) {
                        conn.activate();
                    } else {
                        poolEntry.assignConnection(connFactory.createConnection(null));
                    }
                    if (log.isDebugEnabled()) {
                        log.debug("Connection leased: " + ConnPoolSupport.formatStats(
                                poolEntry.getConnection(), route, state, pool));
                    }

source code here 源代码在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Httpclient 4.3阻塞连接池 - Httpclient 4.3 blocking on connection pool HttpClient连接池关闭 - HttpClient Connection pool shut down 通过HttpClient的Tomcat管理器连接 - Tomcat manager connection through HttpClient 使用Oracle UCP连接池管理器时如何获得连接? - How to get Connection when using Oracle UCP Connection Pool Manager? 何时使用 Spring JPA (Hibernate) Entity Manager 将连接返回到连接池? - When are connections returned to the connection pool with Spring JPA (Hibernate) Entity Manager? 关闭实体管理器时,是否总是将连接签入c3p0连接池? - Will a connection always be checked in to a c3p0 connection pool, when closing the entity manager? 连接池 - Connection Pool apache HttpClient API中的setConnectionTimeout,setSoTimeout和“http.connection-manager.timeout”之间有什么区别 - What is the difference between the setConnectionTimeout , setSoTimeout and “http.connection-manager.timeout” in apache HttpClient API 如果我不使用自定义连接管理器,我还应该在Apache HttpClient上设置ConnectionRequestTimeout吗? - Should I still set ConnectionRequestTimeout on Apache HttpClient if I don't use a custom connection manager? HttpClient,ConnectionManager和怪异的池限制 - HttpClient, ConnectionManager and weird pool limits
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM