@Override
 public void run(ArrayList<IpModel> list) {
   final float dayTime = 24 * 60; // 单位是minute
   final float bi = getWeight() / dayTime;
   for (IpModel temp : list) {
     if (temp.finally_success_time == null || temp.finally_success_time.equals("")) continue;
     long lastSuccTime = Long.parseLong(temp.finally_success_time);
     long now = System.currentTimeMillis();
     long offTime = (now - lastSuccTime) / 1000 / 60; // 单位是minute
     if (offTime > dayTime) {
       continue;
     } else {
       temp.grade += (getWeight() - (offTime * bi));
     }
   }
 }
Example #2
0
  public void updataData() {

    // 测试任务
    ArrayList<TaskModel> taskList = TaskManager.getInstance().list;
    if (taskList != null) {
      task_list_start.setText("任务总数量:" + taskList.size() + "\n");
    } else {
      task_list_start.setText("任务总数量:" + 0 + "\n");
    }

    // httpdns后台任务
    String timerInfoStr = "任务更新间隔:" + (DNSCache.getInstance().sleepTime / 1000) + "秒\n";
    timerInfoStr += "任务启动时间倒计时:" + DNSCache.getInstance().getTimerDelayedStartTime() + "\n";
    http_dns_timer_start.setText(timerInfoStr);

    // IDnsCache 缓存接口
    IDnsCache dnsCache = DNSCache.getInstance().getDnsCacheManager();
    // 内存缓存层数据提取
    ArrayList<DomainModel> memoryCacheList = dnsCache.getAllMemoryCache();
    String memoryCacheStr = "";
    for (DomainModel model : memoryCacheList) {
      memoryCacheStr += model.toString();
    }
    memory_cache_data.setText(memoryCacheStr);
    // domain表数据提取
    ArrayList<DomainModel> tableDomainList = dnsCache.getAllTableDomain();
    String tableDomainStr = "";
    for (DomainModel model : tableDomainList) {
      tableDomainStr += model.toString();
    }
    domain_table_data.setText(tableDomainStr);
    ArrayList<IpModel> tableIpList = dnsCache.getTableIP();
    String tableIpStr = "";
    for (IpModel model : tableIpList) {
      tableIpStr += model.toString();
    }
    ip_table_data.setText(tableIpStr);

    ArrayList<String> httpdnsDatalist = DNSCache.getInstance().dnsManager.getDebugInfo();
    String res = "";
    for (String str : httpdnsDatalist) {
      res += "*\n" + str + "\n\n";
    }
    httpdns_api_data.setText(res);
  }