process = Runtime.getRuntime().exec(cmd); 
            BufferedReader prcout = new BufferedReader(
            new InputStreamReader(
            new BufferedInputStream(process.getInputStream())));
            
            System.err.println("into");
            while ((line=prcout.readLine()) != null){
                System.err.println("io");
                coll.add(line);  
                System.err.println("over");
                process.waitFor();
            }   prcout.close();
 关键代码!当我传入日期范围大些时,在while循环出无法进行下去,会被卡住 但也不会出错!应该如何处理呢 其中Perl脚本是来查询数据库中记录,无误             

解决方案 »

  1.   

     public Collection getDprcInfo(StringBuffer permid,StringBuffer begDt,StringBuffer endDt) throws InterruptedException{
            Collection coll = new ArrayList();
            System.out.println("prel");
            String perlCmd = "C:/Scripts/get_sec_dprc_info.pl --Permid "+permid.toString()+" --beg "+begDt.toString()+" --end "+endDt.toString();
            String cmd = "C:\\cygwin\\bin\\bash.exe -lc \"perl "+perlCmd+" \" ";
            System.out.println(cmd);
                Process process;
                String line;
           
            try {
                process = Runtime.getRuntime().exec(cmd); 
                BufferedReader prcout = new BufferedReader(
                new InputStreamReader(
                new BufferedInputStream(process.getInputStream())));
                            while ((line=prcout.readLine()) != null){
                    coll.add(line);  
                    process.waitFor();
                }   prcout.close();
                  
               
            } catch (IOException ex) {
                ex.printStackTrace();
            }       
                return coll;           
        }调用perl脚本!其中perl脚本是用来查询数据库中的满足条件的所有记录!当我输入日期后 需要将查询出的数据全部放在集合中!但 程序进行到while条件处 就不在继续,也不报错,也无异常!!!!!是否因为查询出数据量过大的原因呢!忘帮忙指点
      

  2.   

    C:\\cygwin\\bin\\bash.exe   
    如果是缓冲问题,就是这个的问题,解决要从这里入手