Blake1991
Blake1991
2015-06-02 03:08

多数据下的多线程问题,

5
  • 数据
  • 多线程
for(int i=0;i<CList.size();i++){
      Map map=new HashMap();
      Map map1=new HashMap();
      String url = (String) CList.get(i).get("url");
      map.put("url",url);
      Clob clob=(Clob) CList.get(i).get("content");
      Reader inStream = clob.getCharacterStream();
      BufferedReader br=new BufferedReader(inStream);
      String data=null;
      data=br.readLine();
      StringBuffer sb =new StringBuffer();
      if(data!=null){
         sb.append(data);
      }
      String reString =sb.toString();
      reString=reString.replaceAll("[\\pP+~$`^=|<>~`$^+=|<>¥×]", "").replaceAll("\\s+","").replaceAll("\u3000","");
      List<Term> tList = NlpAnalysis.parse(reString,forest);
      System.out.println("=============================================");
      System.out.println("=============================================");
      System.out.println("=============================================");
      System.out.println("第   "+i +"  次执行。。。。。。。。。。。");
      System.out.println("------------------------------------------------------>");
      System.out.println("------------------------------------------------------>");
      System.out.println("------------------------------------------------------>");
      new NatureRecognition(tList).recognition();
      tList = FilterModifWord.modifResult(tList);
      System.out.println("-------------------------------------------------------------------------------------");
      System.out.println(tList);
      System.out.println("-------------------------------------------------------------------------------------");
      String aStr = getFormatStr(tList);
      System.out.println(aStr);
      String gmid = (String) CList.get(i).get("gm_id");
      map.put("content", aStr);
      map.put("gm_id", gmid);
      if( gmid!=null && gmid !=""){
        map1.put("url",url);
        map1.put("content", aStr);
        map1.put("gm_id",gmid);
      }
      System.out.println(mList);
      mList.add(map);
      mList1.add(map1);
    }
    if(mList!=null && mList.size()>0){
        ThreadPool tp = new ThreadPool(mList,1,flag1);
        tp.run();
    }
    if(mList1!=null && mList1.size()>0){
        ThreadPool ct1 = new ThreadPool(mList1,2,flag1);
        ct1.run();
    }
    cList大概有3000条数据,但下面的线程代码执行不到,求高手解答
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐

换一换