Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-37121] Use WorkspaceList.record, not .acquire, when dehydrat…
  • Loading branch information
jglick committed Aug 3, 2016
1 parent fe82acd commit bed2b2e
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -64,7 +64,14 @@ private WorkspaceListLeasePickle(WorkspaceList.Lease lease) {
return null;
}
FilePath fp = new FilePath(ch, path);
return c.getWorkspaceList().acquire(fp);
// Since there is no equivalent to Lock.tryLock for WorkspaceList (.record would work but throws AssertionError and swaps the holder):
WorkspaceList.Lease lease = c.getWorkspaceList().allocate(fp);
if (lease.path.equals(fp)) {
return lease;
} else { // @2 or other variant, not what we expected to be able to lock without contention
lease.release();
throw new IllegalStateException("JENKINS-37121: something already locked " + fp);
}
}
};
}
Expand Down

0 comments on commit bed2b2e

Please sign in to comment.