Skip to content
Browse files
[FIXED JENKINS-40879] Only call proceed with resources to lock.
Previously, we were calling LockStepExecution.proceed with the full
list of resources - which was resulting in *everything* getting
unlocked if there was a next context, i.e., if anything else was
waiting on a resource to be unlocked. That was wrong, obviously.

This changes to instead only call proceed with the list of resource
names we actually need to lock for the next context, which fixes the
test in the previous commit.
  • Loading branch information
abayer committed Feb 16, 2017
1 parent 19119d6 commit a7cc1aa694beed617aae302a7e04e770c81ec7aa
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/main/java/org/jenkins/plugins/lockableresources/
@@ -324,10 +324,13 @@ public synchronized void unlockNames(@Nullable List<String> resourceNamesToUnLoc
} else {
List<String> resourceNamesToLock = new ArrayList<String>();

// lock all (old and new resources)
for (LockableResource requiredResource : requiredResourceForNextContext) {
try {
} catch (Exception e) {
throw new IllegalStateException("Can not access the context of a running build", e);
@@ -353,11 +356,7 @@ public synchronized void unlockNames(@Nullable List<String> resourceNamesToUnLoc
this.freeResources(freeResources, build);

// continue with next context
List<String> resourceNames = new ArrayList<String>();
for (LockableResource resource : this.resources) {
LockStepExecution.proceed(resourceNames, nextContext.getContext(), nextContext.getResourceDescription(), inversePrecedence);
LockStepExecution.proceed(resourceNamesToLock, nextContext.getContext(), nextContext.getResourceDescription(), inversePrecedence);

0 comments on commit a7cc1aa

Please sign in to comment.