Skip to content

Commit

Permalink
Do not unlock what might not be locked
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergondza committed Oct 3, 2017
1 parent 1d6412a commit 3966482
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/hudson/matrix/MatrixProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
/**
* Lock to prevent project changes on different build at the same time
*/
private transient Lock buildLock = new ReentrantLock();
private transient @Nonnull ReentrantLock buildLock = new ReentrantLock();

public MatrixProject(String name) {
this(Jenkins.getInstance(), name);
Expand Down Expand Up @@ -676,24 +676,22 @@ public Combination apply(@Nullable List<String> strings) {
* Configuration for matrix build
*/
/*package*/ static class RunConfiguration {
public Set<MatrixConfiguration> config;
public AxisList axisList;
Set<MatrixConfiguration> config;
AxisList axisList;
}

/**
* Rebuild project settings and return actual configuration and axis list
*/
/*package*/ RunConfiguration getRunConfiguration(MatrixBuildExecution context) throws IOException {
RunConfiguration runConfig = new RunConfiguration();
buildLock.lock();
try {
buildLock.lock();

// give axes a chance to rebuild themselves
runConfig.config = rebuildConfigurations(context);

// deep copy the axes
runConfig.axisList = (AxisList) Jenkins.XSTREAM.fromXML(Jenkins.XSTREAM.toXML(axes));

} finally {
buildLock.unlock();
}
Expand Down

0 comments on commit 3966482

Please sign in to comment.