使用多线程+httpClient连接池+ip代理 请求第三方接口。运行一段时间 出现线程阻塞的情况。目前看线程阻塞都在一个调用的请求里面。
```java
@Retryable(
value = {Exception.class}, // 指定哪些异常需要重试
maxAttempts = 3, // 重试次数
backoff = @Backoff(delay = 3000) // 每次重试间隔2秒
)
@ApiLog(title = "XXXX",businessType = "拼接cookie请求第一部分",resultType = false)
public String disneyByCookies01(String token) throws IOException {
RequestConfig requestConfig = RequestConfig.custom()
// .setSocketTimeout(10000)
// .setConnectTimeout(10000)
.setRedirectsEnabled(false)
.build();
HttpGet httpGet = new HttpGet("https://XXXXXXXX.cn/XXX/XXXXXX-svc-gw/api/auth_code/authorize/v1?activity_code=6119&redirect_type=0&redirect_uri=https://XXXX.activity-24.m.duiba.com.cn/customShare/share?id=Did1NTcxODM&");
httpGet.setConfig(requestConfig);
httpGet.setHeader("User-Agent", "Mozilla/5.0 (Linux; Android 10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/101.0.4951.74 Mobile Safari/537.36");
httpGet.setHeader("Cookie", "piXX-m-sid=" + token + "; platform=8; app_version_code=282; app_version_name=5.1.9; app_device_type=android");
httpGet.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
// 执行请求并获取响应
HttpResponse response = httpClient.execute(httpGet);
int statusCode = response.getStatusLine().getStatusCode();
Header contentTypeHeader = response.getFirstHeader("Location");
String location = contentTypeHeader.getValue();
String accessCode = null;
if (location != null) {
String regex = "&access_code=([^&]*)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(location);
if (matcher.find()) {
accessCode = matcher.group(1); // 提取匹配组中的access_code值
log.info("【success】[线程:" + threadName + "]拼接cookie请求第一部分请求成功" + accessCode);
}
} else {
log.info("【error】[线程:" + threadName + "]拼接cookie请求第一部分请求异常response中获取location失败" + response);
throw new IllegalStateException("【error】[线程:" + threadName + "]拼接cookie请求第一部分请求异常response中获取location失败");
}
return accessCode;
```