/** * Determines if the given configuration is currently running. If any of the configurations are * currently stuck in the queue, it is logged. * * @param execution Contains information about the general build, including the listener used to * log queue blockage. * @param configuration The configuration being checked to see if it's running. * @param mutableWhyMap Mutable map used to track the reasons a configuration is stuck in the * queue. This prevents duplicate reasons from flooding the logs. * @return True if the build represented by the given configuration is currently running or stuck * in the queue. False if the build has finished running. */ private boolean isBuilding( MatrixBuild.MatrixBuildExecution execution, MatrixConfiguration configuration, Map<String, String> mutableWhyMap) { MatrixRun build = configuration.getBuildByNumber(execution.getBuild().getNumber()); if (build != null) { return build.isBuilding(); } Queue.Item queueItem = configuration.getQueueItem(); if (queueItem != null) { String why = queueItem.getWhy(); String key = queueItem.task.getFullDisplayName() + " " + queueItem.id; String oldWhy = mutableWhyMap.get(key); if (why == null) { mutableWhyMap.remove(key); } if (why != null && !why.equals(oldWhy)) { mutableWhyMap.put(key, why); BuildListener listener = execution.getListener(); PrintStream logger = listener.getLogger(); logger.print( "Configuration " + ModelHyperlinkNote.encodeTo(configuration) + " is still in the queue: "); queueItem.getCauseOfBlockage().print(listener); // this is still shown on the same line } } return true; }