try {
return p.getExecutionStrategy().run(MatrixBuild.this, aggregators, listener);
} catch( InterruptedException e ) {
logger.println("Aborted");
Executor x = Executor.currentExecutor();
x.recordCauseOfInterruption(MatrixBuild.this, listener);
return x.abortResult();
} catch (AbortException e) {
logger.println(e.getMessage());
return Result.FAILURE;
} finally {
// if the build was aborted in the middle. Cancel all the configuration builds.
Queue q = Jenkins.getInstance().getQueue();
synchronized(q) {// avoid micro-locking in q.cancel.
final int n = getNumber();
for (MatrixConfiguration c : p.getActiveConfigurations()) {
if(q.cancel(c))
logger.println(Messages.MatrixBuild_Cancelled(ModelHyperlinkNote.encodeTo(c)));
MatrixRun b = c.getBuildByNumber(n);
if(b!=null && b.isBuilding()) {// executor can spend some time in post production state, so only cancel in-progress builds.
Executor exe = b.getExecutor();
if(exe!=null) {
logger.println(Messages.MatrixBuild_Interrupting(ModelHyperlinkNote.encodeTo(b)));
exe.interrupt();
}
}
}
}
}