Java:jvm 全局超时是否通过代理起作用?
我设置了 2 个全局网络超时:
System.setProperty("sun.net.client.defaultConnectTimeout", "2000");
System.setProperty("sun.net.client.defaultReadTimeout", "3000");
在直接连接的情况下它工作正常。但如果为 JVM 设置了代理,连接将保持等待状态几分钟。
代理是通过 JVM 参数设置的:
http.proxyHost=some_host
http.proxyPort=8080
如果涉及代理,为什么连接不会因超时而中断? 一般来说,什么网络配置可以防止 http 连接/读取超时正常运行?
I set 2 global networking timeouts:
System.setProperty("sun.net.client.defaultConnectTimeout", "2000");
System.setProperty("sun.net.client.defaultReadTimeout", "3000");
It works fine when in case of direct connections. But if proxy is set for the JVM, connections are kept in waiting state few minutes.
Proxy is alo set via JVM params:
http.proxyHost=some_host
http.proxyPort=8080
Why connections are not interrupted by timeout if proxy is involved?
In general what network configuration can prevent http connection/read timeouts to act properly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们在 JVM 和代理之间工作。就其本质而言,代理应该几乎立即反映它从服务器接收到或未接收到的内容,尽管人们对于如何实现自制代理确实有奇怪的想法。但 JVM 超时实际上并不会在代理上生效。
They work between the JVM and the proxy. By its nature the proxy should be reflecting what it is or isn't receiving from the server almost instantaneously, although people do have strange ideas about how to implement homegrown proxies. But the JVM timeouts don't actually take effect at the proxy.