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