in server/src/jetbrains/buildServer/sharedResources/server/SharedResourcesStartBuildPrecondition.java [206:225]
private WaitReason processBuildInChain(@NotNull final DistributionDataAccessor accessor,
@NotNull final Supplier<Map<Resource, TakenLock>> takenLocksSupplier,
@NotNull final Map<String, Resource> chainNodeResources,
@NotNull final Map<Resource, Map<BuildPromotionEx, Lock>> chainLocks,
@NotNull final Map<String, Lock> locksToTake,
@NotNull final BuildPromotion buildPromotion,
boolean emulationMode) {
final String projectId = buildPromotion.getProjectId();
WaitReason reason = null;
if (projectId != null) {
final Map<Resource, String> unavailableLocks = myTakenLocks.getUnavailableLocks(locksToTake, takenLocksSupplier.get(), accessor, chainNodeResources, chainLocks, buildPromotion);
if (!unavailableLocks.isEmpty()) {
reason = createWaitReason(unavailableLocks);
} else {
storeResourcesAffinity((BuildPromotionEx)buildPromotion, projectId, takenLocksSupplier.get(), locksToTake.values(), accessor, emulationMode); // assign ANY locks here
// if we are here, then the build will pass on to be started
}
}
return reason;
}