git地址: https://github.com/rholder/guava-retrying
public ListResult getFileUrls(String fileCodes){ try { log.info("[调用服务][common-获取文件路径]开始:{}",fileCodes); return RetryerBuilder.<ListResult>newBuilder() .retryIfException() .withStopStrategy(StopStrategies.stopAfterAttempt(3)) .build().call(() -> { String url =apiDomainConfig.getOuterApiDomainCommon() + "/ossFile/getFileUrls"; JSONObject json = new JSONObject(); json.put("fileCodes",fileCodes); ListResult listResult = clientService.getRestTemplate( json , url , ListResult.class); return listResult; }); } catch (Exception e) { log.error("[调用服务][common-获取文件路径]补偿失败3次",e); return Resulter.listResult(BaseCodeEnum.NETWORK_ERROR); } finally { log.info("[调用服务][common-获取文件路径]结束"); } }