规范部分代码

This commit is contained in:
Binary Wang
2017-12-16 18:50:07 +08:00
parent d804d153fc
commit b1aafae6da
12 changed files with 69 additions and 53 deletions

View File

@ -30,7 +30,7 @@ import java.util.Map;
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenComponentServiceImpl implements WxOpenComponentService {
private static final Map<String, WxMpService> wxOpenMpServiceMap = new Hashtable<>();
private static final Map<String, WxMpService> WX_OPEN_MP_SERVICE_MAP = new Hashtable<>();
protected final Logger log = LoggerFactory.getLogger(this.getClass());
private WxOpenService wxOpenService;
@ -40,14 +40,14 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
@Override
public WxMpService getWxMpServiceByAppid(String appId) {
WxMpService wxMpService = wxOpenMpServiceMap.get(appId);
WxMpService wxMpService = WX_OPEN_MP_SERVICE_MAP.get(appId);
if (wxMpService == null) {
synchronized (wxOpenMpServiceMap) {
wxMpService = wxOpenMpServiceMap.get(appId);
synchronized (WX_OPEN_MP_SERVICE_MAP) {
wxMpService = WX_OPEN_MP_SERVICE_MAP.get(appId);
if (wxMpService == null) {
wxMpService = new WxOpenMpServiceImpl(this, appId, getWxOpenConfigStorage().getWxMpConfigStorage(appId));
wxOpenMpServiceMap.put(appId, wxMpService);
WX_OPEN_MP_SERVICE_MAP.put(appId, wxMpService);
}
}
}

View File

@ -30,6 +30,7 @@ public abstract class WxOpenServiceAbstractImpl<H, P> implements WxOpenService,
return wxOpenConfigStorage;
}
@Override
public void setWxOpenConfigStorage(WxOpenConfigStorage wxOpenConfigStorage) {
this.wxOpenConfigStorage = wxOpenConfigStorage;
}