문제

HttpUrlConnection uses persistent connections by default (http://download.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html). Is there any way to inspect Java HTTP connection pool? Eg check how many open connections in the pool?

도움이 되었습니까?

해결책

Unfortunately no. In Oracle's VM, you can in theory inspect the static cache in sun.net.www.http.HttpClient.kac using reflection. This is a Map, which values are Stacks of cached HttpClient instances. The cache however also contains already closed or timed out connections and it does not seem to be a reasonable easy way to filter these out, without actually performing a real HTTP request, in which case abandoned connections will automatically reconnect.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top