🎨 规范lock.lock()代码,统一放在try代码块之外

Co-authored-by: 谢炳庭 <xiebingting@xiongmaocar.com>
This commit is contained in:
ArBing 2020-07-17 09:27:19 +08:00 committed by GitHub
parent 56a271c11c
commit 3b8c66a7e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -33,8 +33,8 @@ public class WxMaJsapiServiceImpl implements WxMaJsapiService {
@Override
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
Lock lock = this.wxMaService.getWxMaConfig().getCardApiTicketLock();
lock.lock();
try {
lock.lock();
if (forceRefresh) {
this.wxMaService.getWxMaConfig().expireCardApiTicket();
}
@ -60,8 +60,8 @@ public class WxMaJsapiServiceImpl implements WxMaJsapiService {
@Override
public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
Lock lock = this.wxMaService.getWxMaConfig().getJsapiTicketLock();
lock.lock();
try {
lock.lock();
if (forceRefresh) {
this.wxMaService.getWxMaConfig().expireJsapiTicket();
}

View File

@ -101,8 +101,8 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
@Override
public String getTicket(TicketType type, boolean forceRefresh) throws WxErrorException {
Lock lock = this.getWxMpConfigStorage().getTicketLock(type);
lock.lock();
try {
lock.lock();
if (forceRefresh) {
this.getWxMpConfigStorage().expireTicket(type);
}

View File

@ -49,8 +49,8 @@ public class WxMpCardServiceImpl implements WxMpCardService {
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
final TicketType type = TicketType.WX_CARD;
Lock lock = getWxMpService().getWxMpConfigStorage().getTicketLock(type);
lock.lock();
try {
lock.lock();
if (forceRefresh) {
this.getWxMpService().getWxMpConfigStorage().expireTicket(type);