Skip to content

Commit 3b8c66a

Browse files
arbing谢炳庭
andauthored
🎨 规范lock.lock()代码,统一放在try代码块之外
Co-authored-by: 谢炳庭 <[email protected]>
1 parent 56a271c commit 3b8c66a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaJsapiServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public String getCardApiTicket() throws WxErrorException {
3333
@Override
3434
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
3535
Lock lock = this.wxMaService.getWxMaConfig().getCardApiTicketLock();
36+
lock.lock();
3637
try {
37-
lock.lock();
3838
if (forceRefresh) {
3939
this.wxMaService.getWxMaConfig().expireCardApiTicket();
4040
}
@@ -60,8 +60,8 @@ public String getJsapiTicket() throws WxErrorException {
6060
@Override
6161
public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
6262
Lock lock = this.wxMaService.getWxMaConfig().getJsapiTicketLock();
63+
lock.lock();
6364
try {
64-
lock.lock();
6565
if (forceRefresh) {
6666
this.wxMaService.getWxMaConfig().expireJsapiTicket();
6767
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public String getTicket(TicketType type) throws WxErrorException {
101101
@Override
102102
public String getTicket(TicketType type, boolean forceRefresh) throws WxErrorException {
103103
Lock lock = this.getWxMpConfigStorage().getTicketLock(type);
104+
lock.lock();
104105
try {
105-
lock.lock();
106106
if (forceRefresh) {
107107
this.getWxMpConfigStorage().expireTicket(type);
108108
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpCardServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public String getCardApiTicket() throws WxErrorException {
4949
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
5050
final TicketType type = TicketType.WX_CARD;
5151
Lock lock = getWxMpService().getWxMpConfigStorage().getTicketLock(type);
52+
lock.lock();
5253
try {
53-
lock.lock();
5454

5555
if (forceRefresh) {
5656
this.getWxMpService().getWxMpConfigStorage().expireTicket(type);

0 commit comments

Comments
 (0)