Ste*_*fza 6 java multithreading unirest
我的网络应用程序似乎内存不足,我认为这是由于线程泄漏。线程似乎一直在等待,并且越来越大,直到内存达到堆大小的顶部。在空闲且不使用 Web 应用程序时,Web 应用程序的本地 Tomcat 服务器上的线程大小会增加。我对线程泄漏没有很好的理解,但我确信线程应该被释放以释放分配的内存。
我进行了线程转储,其中很多线程都在 com.mashape.unirest.http.utils.SyncIdleConnectionMonitorThread 上等待,如下所示。
"Thread-124" - Thread t@378
java.lang.Thread.State: TIMED_WAITING
at java.lang.Object.wait(Native Method)
- waiting on <44c53e01> (a com.mashape.unirest.http.utils.SyncIdleConnectionMonitorThread)
at com.mashape.unirest.http.utils.SyncIdleConnectionMonitorThread.run(SyncIdleConnectionMonitorThread.java:22)
Locked ownable synchronizers:
- None
"Thread-122" - Thread t@371
java.lang.Thread.State: TIMED_WAITING
at java.lang.Object.wait(Native Method)
- waiting on <3212c7ae> (a com.mashape.unirest.http.utils.SyncIdleConnectionMonitorThread)
at com.mashape.unirest.http.utils.SyncIdleConnectionMonitorThread.run(SyncIdleConnectionMonitorThread.java:22)
Locked ownable synchronizers:
- None
Run Code Online (Sandbox Code Playgroud)
任何解决此问题的有用提示将不胜感激。
这似乎是 mashape Unirest 中的一个错误,如果您创建多个 unirest 实例,它不会关闭线程。
我已经开始使用 konghq 版本的 unirest,它解决了问题。
可以在这里找到:https ://mvnrepository.com/artifact/com.konghq/unirest-java
| 归档时间: |
|
| 查看次数: |
499 次 |
| 最近记录: |