我正在寻找一种方法来打开许多与 Java 网站的连接。
我的问题是服务器响应时间在很多情况下真的很慢。因此,我认为寻找一些可以处理打开许多连接并且可能在连接/响应准备好时使用处理程序的 java 库是一个好主意。
有没有类似的东西(这是伪代码!!)
getWebsiteContent(URL url) { //does not wait for the response
new AsynchronousConnection(url) {
requestServedHandler(ConnectionObject) {
InputStream is = ConnectionObject.getInputStream();
//here I will process the content of the stream only when it is available
}
}
}
我不介意给我原始 HTML 的处理程序。