🎨 增加加锁的超时时间,避免死循环
This commit is contained in:
@@ -263,6 +263,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
||||
}
|
||||
|
||||
Lock lock = this.getWxMpConfigStorage().getAccessTokenLock();
|
||||
long timeOutMillis = System.currentTimeMillis() + 3000;
|
||||
boolean locked = false;
|
||||
try {
|
||||
do {
|
||||
@@ -270,6 +271,9 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
||||
if (!forceRefresh && !this.getWxMpConfigStorage().isAccessTokenExpired()) {
|
||||
return this.getWxMpConfigStorage().getAccessToken();
|
||||
}
|
||||
if (!locked && System.currentTimeMillis() > timeOutMillis) {
|
||||
throw new InterruptedException("获取accessToken超时:获取时间超时");
|
||||
}
|
||||
} while (!locked);
|
||||
|
||||
String response;
|
||||
|
||||
Reference in New Issue
Block a user