Exemplo n.º 1
0
 public void loadConfigInfoToDisk(String dataId, String group) {
   try {
     DiamondStone diamondStone = persistService.findConfigInfo(dataId, group);
     if (diamondStone != null && diamondStone.isValid()) {
       contentMD5Cache.put(createMD5CacheKey(dataId, group), diamondStone.getMd5());
       diskService.saveToDisk(diamondStone);
     } else {
       contentMD5Cache.remove(createMD5CacheKey(dataId, group));
       diskService.removeConfigInfo(dataId, group);
     }
   } catch (Exception e) {
     log.error("loadConfigInfoToDisk error", e);
     throw Throwables.propagate(e);
   }
 }
Exemplo n.º 2
0
  public void removeConfigInfo(long id) {
    try {
      DiamondStone diamondStone = persistService.findConfigInfo(id);
      diskService.removeConfigInfo(diamondStone.getDataId(), diamondStone.getGroup());
      contentMD5Cache.remove(createMD5CacheKey(diamondStone.getDataId(), diamondStone.getGroup()));
      persistService.removeConfigInfo(diamondStone);
      notifyOtherNodes(diamondStone.getDataId(), diamondStone.getGroup());

    } catch (Exception e) {
      log.error("remove config info error", e);
      throw Throwables.propagate(e);
    }
  }
Exemplo n.º 3
0
 public void addConfigInfo(
     String dataId, String group, String content, String description, boolean valid) {
   checkParameter(dataId, group, content);
   DiamondStone diamondStone = new DiamondStone(dataId, group, content, description, valid);
   try {
     persistService.addConfigInfo(diamondStone);
     contentMD5Cache.put(createMD5CacheKey(dataId, group), diamondStone.getMd5());
     diskService.saveToDisk(diamondStone);
     notifyOtherNodes(dataId, group);
   } catch (Exception e) {
     log.error("addConfigInfo error", e);
     throw Throwables.propagate(e);
   }
 }