2

这是我的代码:

def search = {item->
    def url = "http://localhost:8080/search/"+item
    println 'url='+ url
    page = webClient.getPage(url);
    println 'pageURL=' + page.url
}

GParsPool.withPool(5) {
    searchList.each  {item-> search.callAsync(item) }
}

它打印这个:

url=http://localhost:8080/search/1
url=http://localhost:8080/search/3
url=http://localhost:8080/search/5
url=http://localhost:8080/search/4
url=http://localhost:8080/search/2
pageURL=http://localhost:8080/search/5
pageURL=http://localhost:8080/search/5
pageURL=http://localhost:8080/search/5
pageURL=http://localhost:8080/search/5
url=http://localhost:8080/search/7
url=http://localhost:8080/search/6
pageURL=http://localhost:8080/search/5
url=http://localhost:8080/search/9
url=http://localhost:8080/search/8
url=http://localhost:8080/search/10
pageURL=http://localhost:8080/search/10
pageURL=http://localhost:8080/search/8
pageURL=http://localhost:8080/search/6
pageURL=http://localhost:8080/search/6
pageURL=http://localhost:8080/search/6

为什么 pageURL 与 URL 不匹配?第 5 项有多个请求,第 1 项没有请求。

4

0 回答 0