mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-29 17:48:50 +08:00
🎨 调整加锁与获取缓存的顺序
This commit is contained in:
@ -267,10 +267,10 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
||||
boolean locked = false;
|
||||
try {
|
||||
do {
|
||||
locked = lock.tryLock(100, TimeUnit.MILLISECONDS);
|
||||
if (!forceRefresh && !this.getWxMpConfigStorage().isAccessTokenExpired()) {
|
||||
return this.getWxMpConfigStorage().getAccessToken();
|
||||
}
|
||||
locked = lock.tryLock(100, TimeUnit.MILLISECONDS);
|
||||
if (!locked && System.currentTimeMillis() > timeOutMillis) {
|
||||
throw new InterruptedException("获取accessToken超时:获取时间超时");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user