コード例 #1
0
 private void checkLocalConfigInfo() {
   for (Entry<String /* dataId */, ConcurrentHashMap<String /* group */, CacheData>>
       cacheDatasEntry : cache.entrySet()) {
     ConcurrentHashMap<String, CacheData> cacheDatas = cacheDatasEntry.getValue();
     if (null == cacheDatas) {
       continue;
     }
     for (Entry<String, CacheData> cacheDataEntry : cacheDatas.entrySet()) {
       final CacheData cacheData = cacheDataEntry.getValue();
       try {
         String configInfo = getLocalConfigureInfomation(cacheData);
         if (null != configInfo) {
           if (log.isInfoEnabled()) {
             log.info(
                 "Read local configure, dataId:"
                     + cacheData.getDataId()
                     + ", group:"
                     + cacheData.getGroup());
           }
           popConfigInfo(cacheData, configInfo);
           continue;
         }
         if (cacheData.isUseLocalConfigInfo()) {
           continue;
         }
       } catch (Exception e) {
         log.error("checkLocalConfigInfo error:", e);
       }
     }
   }
 }
コード例 #2
0
  private String getProbeUpdateString() {
    StringBuilder probeModifyBuilder = new StringBuilder();
    for (Entry<String, ConcurrentHashMap<String, CacheData>> cacheDatasEntry :
        this.cache.entrySet()) {
      String dataId = cacheDatasEntry.getKey();
      ConcurrentHashMap<String, CacheData> cacheDatas = cacheDatasEntry.getValue();
      if (null == cacheDatas) {
        continue;
      }
      for (Entry<String, CacheData> cacheDataEntry : cacheDatas.entrySet()) {
        final CacheData data = cacheDataEntry.getValue();
        if (!data.isUseLocalConfigInfo()) {
          probeModifyBuilder.append(dataId).append(WORD_SEPARATOR);

          if (null != cacheDataEntry.getValue().getGroup()
              && Constants.NULL != cacheDataEntry.getValue().getGroup()) {
            probeModifyBuilder.append(cacheDataEntry.getValue().getGroup()).append(WORD_SEPARATOR);
          } else {
            probeModifyBuilder.append(WORD_SEPARATOR);
          }

          if (null != cacheDataEntry.getValue().getMd5()
              && Constants.NULL != cacheDataEntry.getValue().getMd5()) {
            probeModifyBuilder.append(cacheDataEntry.getValue().getMd5()).append(LINE_SEPARATOR);
          } else {
            probeModifyBuilder.append(LINE_SEPARATOR);
          }
        }
      }
    }
    String probeModifyString = probeModifyBuilder.toString();
    return probeModifyString;
  }
コード例 #3
0
 private void checkSnapshot() {
   for (Entry<String, ConcurrentHashMap<String, CacheData>> cacheDatasEntry : cache.entrySet()) {
     ConcurrentHashMap<String, CacheData> cacheDatas = cacheDatasEntry.getValue();
     if (null == cacheDatas) {
       continue;
     }
     for (Entry<String, CacheData> cacheDataEntry : cacheDatas.entrySet()) {
       final CacheData cacheData = cacheDataEntry.getValue();
       if (!cacheData.isUseLocalConfigInfo() && cacheData.getFetchCount() == 0) {
         String configInfo =
             getSnapshotConfigInformation(cacheData.getDataId(), cacheData.getGroup());
         if (configInfo != null) {
           popConfigInfo(cacheData, configInfo);
         }
       }
     }
   }
 }