Source:
<code>protected Result doRun(BuildListener listener) throws Exception { MatrixProject p = getProject(); PrintStream logger = listener.getLogger(); try { <START> p.buildLock(); <END> activeConfigurations = p.rebuildConfigurations(this); listUpAggregators(p.getPublishers().values()); listUpAggregators(p.getProperties().values()); listUpAggregators(p.getBuildWrappers().values()); axes = (AxisList) Jenkins.XSTREAM.fromXML(Jenkins.XSTREAM.toXML(p.getAxes())); } finally { p.buildUnlock(); } try { return p.getExecutionStrategy().run(this); } catch( InterruptedException e ) { logger.println("Aborted"); Executor x = Executor.currentExecutor(); if (x == null) { throw new IOException("The build has been aborted, but its executor is not available"); } x.recordCauseOfInterruption(MatrixBuild.this, listener); return x.abortResult(); } catch (AbortException e) { logger.println(e.getMessage()); return Result.FAILURE; } finally { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { logger.println("Jenkins instance is not ready. Cannot interrupt configurations"); } else { Queue q = jenkins.getQueue(); synchronized(q) { final int n = getNumber(); for (MatrixConfiguration c : activeConfigurations) { for (Item i : q.getItems(c)) { ParentBuildAction a = i.getAction(ParentBuildAction.class); if (a!=null && a.parent==getBuild()) { q.cancel(i); logger.println(Messages.MatrixBuild_Cancelled(ModelHyperlinkNote.encodeTo(c))); } } MatrixRun b = c.getBuildByNumber(n); if(b!=null && b.isBuilding()) { Executor exe = b.getExecutor(); if(exe!=null) { logger.println(Messages.MatrixBuild_Interrupting(ModelHyperlinkNote.encodeTo(b))); exe.interrupt(); } } } } } } }</code><technical_language>lock outside. logic of listUpAggregators belongs MatrixProject locking place. - operation race this? I is configuration update rebuilding configurations I do synchronized lock</technical_language>

Target:
protected Result doRun(BuildListener listener) throws Exception { MatrixProject p = getProject(); PrintStream logger = listener.getLogger(); listUpAggregators(p.getPublishers().values()); listUpAggregators(p.getProperties().values()); listUpAggregators(p.getBuildWrappers().values()); MatrixProject.RunConfiguration config = p.getRunConfiguration(this); activeConfigurations = config.config; axes = config.axisList; try { return p.getExecutionStrategy().run(this); } catch( InterruptedException e ) { logger.println("Aborted"); Executor x = Executor.currentExecutor(); if (x == null) { throw new IOException("The build has been aborted, but its executor is not available"); } x.recordCauseOfInterruption(MatrixBuild.this, listener); return x.abortResult(); } catch (AbortException e) { logger.println(e.getMessage()); return Result.FAILURE; } finally { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { logger.println("Jenkins instance is not ready. Cannot interrupt configurations"); } else { Queue q = jenkins.getQueue(); synchronized(q) { final int n = getNumber(); for (MatrixConfiguration c : activeConfigurations) { for (Item i : q.getItems(c)) { ParentBuildAction a = i.getAction(ParentBuildAction.class); if (a!=null && a.parent==getBuild()) { q.cancel(i); logger.println(Messages.MatrixBuild_Cancelled(ModelHyperlinkNote.encodeTo(c))); } } MatrixRun b = c.getBuildByNumber(n); if(b!=null && b.isBuilding()) { Executor exe = b.getExecutor(); if(exe!=null) { logger.println(Messages.MatrixBuild_Interrupting(ModelHyperlinkNote.encodeTo(b))); exe.interrupt(); } } } } } } }