private void checkpoint(boolean last) throws PEException { final long total = globalCounters.getOccurances(GlobalCounters.LINES); if (last || ((total % checkpointInterval) == 0)) { outputStream.println("Writing checkpoint file, total stmts: " + total); final String corpusString = PEXmlUtils.marshalJAXB(corpus); final File prevFile = new File(checkpointFile.getAbsolutePath() + ".prev"); if (prevFile.exists()) { prevFile.delete(); } if (checkpointFile.exists()) { checkpointFile.renameTo(prevFile); } PEFileUtils.writeToFile(checkpointFile, corpusString, true); } if (last) { final String corpusString = PEXmlUtils.marshalJAXB(sortByFrequency()); PEFileUtils.writeToFile(corpusFile, corpusString, true); printSummary(outputStream); } flushErrorLog(); }
public static <T> BootstrapHost startServices(Class<T> bootstrapClass) throws Exception { return startServices( bootstrapClass, PEFileUtils.loadPropertiesFile(bootstrapClass, PEConstants.CONFIG_FILE_NAME)); }