mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
🐛 修复代码
This commit is contained in:
parent
d752c48dc8
commit
c175a31c45
@ -3,6 +3,8 @@ package me.chanjar.weixin.common.util.locks;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
import com.github.jedis.lock.JedisLock;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.util.Pool;
|
||||
|
||||
|
@ -23,8 +23,8 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
@ -158,12 +158,12 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
|
||||
Lock lock = this.getWxOpenConfigStorage().getComponentAccessTokenLock();
|
||||
lock.lock();
|
||||
try {
|
||||
if (StringUtils.equals(componentAccessToken, this.getWxOpenConfigStorage().getComponentAccessToken()){
|
||||
if (StringUtils.equals(componentAccessToken, this.getWxOpenConfigStorage().getComponentAccessToken())) {
|
||||
this.getWxOpenConfigStorage().expireComponentAccessToken();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
this.getWxOpenConfigStorage().expireComponentAccessToken();
|
||||
}finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@ -202,12 +202,12 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
|
||||
Lock lock = this.getWxOpenConfigStorage().getComponentAccessTokenLock();
|
||||
lock.lock();
|
||||
try {
|
||||
if (StringUtils.equals(componentAccessToken, this.getWxOpenConfigStorage().getComponentAccessToken()){
|
||||
if (StringUtils.equals(componentAccessToken, this.getWxOpenConfigStorage().getComponentAccessToken())) {
|
||||
this.getWxOpenConfigStorage().expireComponentAccessToken();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
this.getWxOpenConfigStorage().expireComponentAccessToken();
|
||||
}finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
if (this.getWxOpenConfigStorage().autoRefreshToken()) {
|
||||
@ -379,13 +379,13 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
|
||||
@Override
|
||||
public String getAuthorizerAccessToken(String appId, boolean forceRefresh) throws WxErrorException {
|
||||
WxOpenConfigStorage config = getWxOpenConfigStorage();
|
||||
if (!config.isAuthorizerAccessTokenExpired(appId) && !forceRefresh){
|
||||
if (!config.isAuthorizerAccessTokenExpired(appId) && !forceRefresh) {
|
||||
return config.getAuthorizerAccessToken(appId);
|
||||
}
|
||||
Lock lock = config.getWxMpConfigStorage(appId).getAccessTokenLock();
|
||||
lock.lock();
|
||||
try{
|
||||
if (!config.isAuthorizerAccessTokenExpired(appId) && !forceRefresh){
|
||||
try {
|
||||
if (!config.isAuthorizerAccessTokenExpired(appId) && !forceRefresh) {
|
||||
return config.getAuthorizerAccessToken(appId);
|
||||
}
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
@ -397,7 +397,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
|
||||
WxOpenAuthorizerAccessToken wxOpenAuthorizerAccessToken = WxOpenAuthorizerAccessToken.fromJson(responseContent);
|
||||
config.updateAuthorizerAccessToken(appId, wxOpenAuthorizerAccessToken);
|
||||
return config.getAuthorizerAccessToken(appId);
|
||||
}finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user