private List<InputBuildId> readListOfBuildIds() { List<InputBuildId> result = new ArrayList<>(); File inputFile = new File(this.config.getInputPath()); try { BufferedReader reader = new BufferedReader(new FileReader(inputFile)); while (reader.ready()) { String line = reader.readLine().trim(); if (!line.isEmpty()) { String[] buildIds = line.split(Utils.COMMA+""); if (buildIds.length > 0) { long buggyBuildId = Long.parseLong(buildIds[0]); if (this.config.getLauncherMode() == LauncherMode.BEARS) { if (buildIds.length > 1) { long patchedBuildId = Long.parseLong(buildIds[1]); result.add(new InputBuildId(buggyBuildId, patchedBuildId)); } else { LOGGER.error("The build "+buggyBuildId+" will not be processed because there is no next build for it in the input file."); } } else { result.add(new InputBuildId(buggyBuildId)); } } } } reader.close(); } catch (IOException e) { throw new RuntimeException("Error while reading build ids from file: "+inputFile.getPath(),e); } return result; }
public void submitBuild(Build build) { if (this.limitDateNextRetrieveDockerImage.before(new Date())) { this.refreshDockerImage(); } if (getRunning() < this.nbThreads) { LOGGER.info("Build (id: "+build.getId()+") immediately submitted for running."); this.executorService.submit(this.submitBuild(this.dockerImageId, new InputBuildId(build.getId()))); } else { LOGGER.info("All threads currently running (Limit: "+this.nbThreads+"). Add build (id: "+build.getId()+") to wait list"); if (this.waitingBuilds.size() == this.nbThreads) { Build b = this.waitingBuilds.removeLast(); LOGGER.debug("Remove oldest build (id: "+b.getId()+")"); } this.waitingBuilds.push(build); } }