public void confirm(String id) {
        System.out.println(MiscTool.getDate() + ":" + "Start committing...");
        confirmPid.add(id);

        File rootDir = new File(proc.getSDFS().getRootDirectory());
        File[] files;
        boolean flag;
        while(true) {
            flag = true;
            if((files=rootDir.listFiles()) == null) {
                logger.error("wrong root dir");
                return;
            }
            for (File file : files) {
                String header = "_tmp_" + id + "_";

                if(file.getName().startsWith(header)) {
                    String newFileName = file.getName().substring(header.length());
//                    if(!proc.getSDFS().hasSDFSFile(newFileName)) {
//                        proc.getSDFS().createLocalSDFSFile(newFileName);
//                    }
                    flag = false;
                    BufferedReader br;
                    try {
                        br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                    } catch (FileNotFoundException e) {
                        logger.error("file not found", e);
                        continue;
                    }
                    String data;
                    try {
                        while((data = br.readLine())!=null ) {
                            proc.getSDFS().appendDataToLocalFile(file.getName().substring(header.length()), data);
                        }
                        br.close();
                    } catch (IOException e) {
                        logger.error("read tmp file error", e);
                    }

                    if(!file.delete()) {
                        logger.error("fail to delete tmp file");
                    }
                }
            }

            if(flag) {
                break;
            }
        }
        System.out.println(MiscTool.getDate() + ":" + "Committing done");
        loadIntermediateFilesToSDFS();
    }