public String getConfigureInformation(String dataId, String group, long timeout) { if (null == group) { group = Constants.DEFAULT_GROUP; } CacheData cacheData = getCacheData(dataId, group); try { String localConfig = localConfigInfoProcessor.getLocalConfigureInfomation(cacheData, true); if (localConfig != null) { cacheData.incrementFetchCountAndGet(); saveSnapshot(dataId, group, localConfig); return localConfig; } } catch (IOException e) { log.error("getLocalConfigureInfomation error:", e); } String result = getConfigureInformation(dataId, group, timeout, false); if (result != null) { saveSnapshot(dataId, group, result); cacheData.incrementFetchCountAndGet(); } return result; }
private String getSnapshotConfigInformation(String dataId, String group) { if (group == null) { group = Constants.DEFAULT_GROUP; } try { CacheData cacheData = getCacheData(dataId, group); String config = this.snapshotConfigInfoProcessor.getConfigInfomation(dataId, group); if (config != null && cacheData != null) { cacheData.incrementFetchCountAndGet(); } return config; } catch (Exception e) { log.error("getSnapshotConfigInformation error dataId=" + dataId + ",group=" + group, e); return null; } }
void popConfigInfo(final CacheData cacheData, final String configInfo) { final ConfigureInfomation configureInfomation = new ConfigureInfomation(); configureInfomation.setConfigureInfomation(configInfo); final String dataId = cacheData.getDataId(); final String group = cacheData.getGroup(); configureInfomation.setDataId(dataId); configureInfomation.setGroup(group); cacheData.incrementFetchCountAndGet(); if (null != this.subscriberListener.getExecutor()) { this.subscriberListener .getExecutor() .execute( new Runnable() { public void run() { try { subscriberListener.receiveConfigInfo(configureInfomation); saveSnapshot(dataId, group, configInfo); } catch (Throwable t) { log.error( "popConfigInfo listener receiveConfigInfo error: group=" + group + ", dataId=" + dataId, t); } } }); } else { try { subscriberListener.receiveConfigInfo(configureInfomation); saveSnapshot(dataId, group, configInfo); } catch (Throwable t) { log.error( "popConfigInfo listener receiveConfigInfo error: group=" + group + ", dataId=" + dataId, t); } } }