public KpiSyncMapping getByName(String name) throws Exception {
   List<KpiSyncMapping> list = getByProperty("name", name);
   if (list.size() == 1) {
     return list.get(0);
   } else if (list.size() > 1) {
     log.eLog("KPI同步映射[" + name + "]不唯一");
     throw new Exception("KPI同步映射[" + name + "]不唯一");
   } else {
     return null;
   }
 }
 public KpiSyncMapping getById(String id) throws Exception {
   List<KpiSyncMapping> list = getByProperty("_id", id);
   if (list.size() == 1) {
     return list.get(0);
   } else if (list.size() > 1) {
     log.eLog("KPI同步映射[" + id + "]不唯一");
     throw new Exception("KPI同步映射[" + id + "]不唯一");
   } else {
     return null;
   }
 }
Example #3
0
  private void cleanupData() {

    log.iLog("开始清理4小时前内存性能数据...");

    // 执行创建
    // 建表
    PreparedStatement ps = null;
    Connection conn = null;
    try {
      // 执行查询
      conn = this.ds.getConnection();
      ps = conn.prepareStatement(this.cleanSql);
      ps.setTimestamp(1, new Timestamp(System.currentTimeMillis() - interval * 1000L));
      int dc = ps.executeUpdate();
      log.iLog("清理4小时前内存性能数据" + dc + "条。");
    } catch (SQLException e) {
      log.eLog("清理4小时前内存性能数据时失败: " + e.getMessage(), e);

    } finally {
      DBUtils.closeAll(conn, ps, null);
    }

    log.iLog("清理4小时前内存性能数据完毕。");
  }