|
|
|
@ -13,7 +13,7 @@ public class Util {
|
|
|
|
|
* @param url 请求URL
|
|
|
|
|
* @return 响应内容
|
|
|
|
|
*/
|
|
|
|
|
public static String doGet(String url) {
|
|
|
|
|
public static String doGet(String url) throws InterruptedException {
|
|
|
|
|
int retries = 3;
|
|
|
|
|
while (retries > 0) {
|
|
|
|
|
try {
|
|
|
|
@ -24,6 +24,7 @@ public class Util {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println("调用失败,正在重试!");
|
|
|
|
|
System.out.println(e);
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
retries--;
|
|
|
|
|
if (retries == 0) {
|
|
|
|
|
throw new RuntimeException("请求失败,已重试3次", e);
|
|
|
|
|