Skip to content

Commit 8ec76bd

Browse files
committed
issue #84 Wx*ConfigStorage在多线程环境下有visibility问题
1 parent 4b8aa69 commit 8ec76bd

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpInMemoryConfigStorage.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
*/
1010
public class WxCpInMemoryConfigStorage implements WxCpConfigStorage {
1111

12-
protected String corpId;
13-
protected String corpSecret;
12+
protected volatile String corpId;
13+
protected volatile String corpSecret;
1414

15-
protected String token;
16-
protected String accessToken;
17-
protected String aesKey;
18-
protected String agentId;
19-
protected long expiresTime;
15+
protected volatile String token;
16+
protected volatile String accessToken;
17+
protected volatile String aesKey;
18+
protected volatile String agentId;
19+
protected volatile long expiresTime;
2020

21-
protected String oauth2redirectUri;
21+
protected volatile String oauth2redirectUri;
2222

23-
protected String http_proxy_host;
24-
protected int http_proxy_port;
25-
protected String http_proxy_username;
26-
protected String http_proxy_password;
23+
protected volatile String http_proxy_host;
24+
protected volatile int http_proxy_port;
25+
protected volatile String http_proxy_username;
26+
protected volatile String http_proxy_password;
2727

2828
public String getAccessToken() {
2929
return this.accessToken;

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpInMemoryConfigStorage.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,22 @@
99
*/
1010
public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
1111

12-
private static final long l = 7000 * 1000l;
13-
14-
protected String appId;
15-
protected String secret;
16-
protected String token;
17-
protected String accessToken;
18-
protected String aesKey;
19-
protected long expiresTime;
20-
21-
protected String oauth2redirectUri;
22-
23-
protected String http_proxy_host;
24-
protected int http_proxy_port;
25-
protected String http_proxy_username;
26-
protected String http_proxy_password;
27-
28-
protected String jsapiTicket;
29-
protected long jsapiTicketExpiresTime;
12+
protected volatile String appId;
13+
protected volatile String secret;
14+
protected volatile String token;
15+
protected volatile String accessToken;
16+
protected volatile String aesKey;
17+
protected volatile long expiresTime;
18+
19+
protected volatile String oauth2redirectUri;
20+
21+
protected volatile String http_proxy_host;
22+
protected volatile int http_proxy_port;
23+
protected volatile String http_proxy_username;
24+
protected volatile String http_proxy_password;
25+
26+
protected volatile String jsapiTicket;
27+
protected volatile long jsapiTicketExpiresTime;
3028

3129
public String getAccessToken() {
3230
return this.accessToken;

0 commit comments

Comments
 (0)