Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,17 @@ private class NewSessionRunnable implements Runnable {

@Override
public void run() {
boolean loop = true;
Set<RequestId> inQueue;
boolean loop;
if (rejectUnsupportedCaps) {
inQueue = sessionQueue.getQueueContents().stream()
.map(SessionRequestCapability::getRequestId)
.collect(Collectors.toSet());
loop = !inQueue.isEmpty();
} else {
inQueue = null;
loop = true;
}
while (loop) {
// We deliberately run this outside of a lock: if we're unsuccessful
// starting the session, we just put the request back on the queue.
Expand All @@ -762,13 +772,11 @@ public void run() {
Map<Capabilities, Long> stereotypes =
getAvailableNodes().stream()
.filter(NodeStatus::hasCapacity)
.map(
.flatMap(
node ->
node.getSlots().stream()
.map(Slot::getStereotype)
.collect(Collectors.toList()))
.flatMap(Collection::stream)
.collect(Collectors.groupingBy(ImmutableCapabilities::new, Collectors.counting()));
.map(Slot::getStereotype))
.collect(Collectors.groupingBy(ImmutableCapabilities::copyOf, Collectors.counting()));

if (!stereotypes.isEmpty()) {
List<SessionRequest> matchingRequests = sessionQueue.getNextAvailable(stereotypes);
Expand All @@ -780,7 +788,9 @@ public void run() {
}
}
if (rejectUnsupportedCaps) {
checkMatchingSlot(sessionQueue.getQueueContents());
checkMatchingSlot(sessionQueue.getQueueContents().stream()
.filter((src) -> inQueue.contains(src.getRequestId()))
.collect(Collectors.toList()));
}
}

Expand Down