spring - Spring RestTemplate 没有为空响应释放连接
问题描述
我有一个 spring-boot 应用程序进行一堆 REST 后端调用。Rest 后端之一是抛出 ConnectionPoolTimeoutException。经过进一步调查,我怀疑当响应为错误或为空时,该后端的连接没有关闭。
尝试调试 Spring RestTemplate 代码,看到一行:
finally {
if (response != null) {
response.close();
}
}
如果响应为空,这看起来不会关闭连接。有没有人遇到过类似的问题,解决方法是什么。我正在考虑编写一个始终关闭连接的拦截器
解决方案
推荐阅读
- macos - mac 中 syscall.StringToUTF16、syscall.CreateFile 和 syscall.DeviceIoControl 的等效 API 是什么
- c# - 单击后如何删除 Monogame 中的精灵?
- mongodb - 如何检索已使用“elementMatch”mongodb匹配的对象元素的所有嵌套数组
- ios - 使用 PDFKIT 在 PDF 查看器中移动文本框 - Swift
- mysql - 如何选择第n行到最后一条记录sql?
- kubernetes - 从子图表访问父(图表)上下文
- python-3.x - 在 S3 存储桶上上传对象时出现问题
- angular - store.select() 在ngrx angular中被多次调用
- javascript - 即使提供了唯一键,在更改父级后子级也无法正确重新渲染
- c++ - C ++循环地图 - 消失的对象