Jersey 客户端在 Java EE 上请求问题

Jersey client requests issues on Java EE

我正在使用 Weblogic 12.2.1 和内置的 Jersey 客户端 2.21.1 每隔几个小时向远程系统发出一批 https 请求。
为此,我有一个 @Singleton bean 和一个 @Scheduled 方法,它在特定时间由 Weblogic 执行。因此,在每次执行 @Scheduled 方法时,我都会一个接一个地进行多个 https 调用。 所有请求都是同步的。

问题是由于某种原因,下一个请求在前一个请求之后延迟一分钟发送(根据 Wireshark 输出)。 Jersey 的调用被阻塞。响应立即到来。远程系统没有问题

在 JUnit 测试(纯 java)中执行时发送请求的相同代码没有延迟。所有请求立即通过。所以也许与 Weblogic 容器有关。
有人有类似问题吗?

实际上,当我将客户端中的默认值 HttpUrlConnectorProvider 更改为 ApacheConnectorProvider 时,请求之间不再有延迟。事实上,Jersey 文档对此的说明是:

...in complex environments (such as application servers), where some poolable connections might exist before your application even bootstraps, this approach is not 100% reliable and we recommend using a different client transport connector, such as Apache Connector.

但是如果你想使用客户端的多部分功能,又会出现另一个问题。关于这个,文档说:

Warning

Be aware of using other than default Connector implementation. There is an issue handling HTTP headers in WriterInterceptor or MessageBodyWriter. If you need to change header fields do not use nor ApacheConnectorProvider nor GrizzlyConnectorProvider neither JettyConnectorProvider. The issue for example applies to Jersey Multipart feature that also modifies HTTP headers.

最后我发现自己处于一种情况,我必须选择没有多部分的 ApacheConnector(快速请求)或多部分的慢速请求。是不是很有趣?

我想我应该花更多时间研究其他 restful 实际在 Java EE 环境中工作的客户。