main
黄海 7 months ago
parent b0651a3a16
commit 03f321d5db

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

Loading…
Cancel
Save