in server/src/jetbrains/buildServer/sharedResources/server/runtime/TakenLocksImpl.java [162:176]
private Map<Resource, TakenLock> purifyTakenLocks(final Map<Resource, TakenLock> takenLocks,
final Map<Resource, Map<BuildPromotionEx, Lock>> chainLocks) {
Map<Resource, TakenLock> result = new HashMap<>();
takenLocks.forEach((rc, tl) -> {
Map<BuildPromotionEx, Lock> chainTakenLock = chainLocks.get(rc);
if (chainTakenLock != null) {
result.put(rc, new TakenLock(rc,
CollectionsUtil.filterMapByKeys(tl.getReadLocks(), key -> !chainTakenLock.containsKey(key)),
CollectionsUtil.filterMapByKeys(tl.getWriteLocks(), key -> !chainTakenLock.containsKey(key))));
} else {
result.put(rc, tl);
}
});
return result;
}