【发布时间】:2019-11-18 15:31:06
【问题描述】:
我将 WildFly 服务器从 10 迁移到 16。它现在使用版本 3.6.3 的 resteasy-client。Final 使用版本 4.5.4 的 http-client。问题是当我从构建器创建 restEasyClient 时,我无法在内部创建连接管理器,如下所示:
this.resteasyClient = new ResteasyClientBuilder()
.connectionPoolSize(DEFAULT_POOL_SIZE)
.maxPooledPerRoute(DEFAULT_POOL_SIZE)
.build();
如何从 ApacheHttpClient43Engine 引擎获取连接管理器?我的最终目标是从经理那里获得 PoolStats,在我的情况下应该是 PoolingHttpClientConnectionManager [PoolingHttpClientConnectionManager#getTotalStats]。
我用来获取连接管理器的代码如下:
ApacheHttpClient43Engine engine = (ApacheHttpClient43Engine) resteasyClient.httpEngine();
ClientConnectionManager cm = engine.getHttpClient().getConnectionManager();
此方法 getConnectionManager() 已弃用,并且不会获取 HttpClientConnectionManager。
如何从我的 restEasyClient 获取 PoolStats?
提前致谢
【问题讨论】:
标签: java httpclient resteasy apache-httpclient-4.x