mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 18:25:10 +08:00
#324: 修复分布式刷新access_token冲突问题
This commit is contained in:
@@ -38,10 +38,7 @@ public class WxCpServiceApacheHttpClientImpl extends WxCpServiceAbstractImpl<Clo
|
||||
|
||||
@Override
|
||||
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
|
||||
if (forceRefresh) {
|
||||
this.configStorage.expireAccessToken();
|
||||
}
|
||||
if (this.configStorage.isAccessTokenExpired()) {
|
||||
if (this.configStorage.isAccessTokenExpired() || forceRefresh) {
|
||||
synchronized (this.globalAccessTokenRefreshLock) {
|
||||
if (this.configStorage.isAccessTokenExpired()) {
|
||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?"
|
||||
|
@@ -29,10 +29,7 @@ public class WxCpServiceJoddHttpImpl extends WxCpServiceAbstractImpl<HttpConnect
|
||||
|
||||
@Override
|
||||
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
|
||||
if (forceRefresh) {
|
||||
this.configStorage.expireAccessToken();
|
||||
}
|
||||
if (this.configStorage.isAccessTokenExpired()) {
|
||||
if (this.configStorage.isAccessTokenExpired() || forceRefresh) {
|
||||
synchronized (this.globalAccessTokenRefreshLock) {
|
||||
if (this.configStorage.isAccessTokenExpired()) {
|
||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?"
|
||||
|
@@ -37,10 +37,7 @@ public class WxCpServiceOkHttpImpl extends WxCpServiceAbstractImpl<OkHttpClient,
|
||||
@Override
|
||||
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
|
||||
logger.debug("WxCpServiceOkHttpImpl is running");
|
||||
if (forceRefresh) {
|
||||
this.configStorage.expireAccessToken();
|
||||
}
|
||||
if (this.configStorage.isAccessTokenExpired()) {
|
||||
if (this.configStorage.isAccessTokenExpired() || forceRefresh) {
|
||||
synchronized (this.globalAccessTokenRefreshLock) {
|
||||
if (this.configStorage.isAccessTokenExpired()) {
|
||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?"
|
||||
|
Reference in New Issue
Block a user