访问链接的重试
锁重试场景
访问链接的重试 Boolean s = false;
int i = 0;
while (true){
s = this.访问第三方接口();
if (s || i > 10){
break;
}
++i;
}
锁重试场景
final String lock = MessageFormat.format(Constant.INVITE_LOCK, inviteUserId);
int count = 0;
while(!stringRedis.setIfAbsent(key, "1", seconds, TimeUnit.SECONDS)){
try {
Thread.sleep(200L);
}catch (Exception e) {
Thread.currentThread().interrupt();
}
count++;
if(count>10){
return null;
}
}



