Set<THostPort> cancellations = null;
for (Entry<InetSocketAddress, TEnqueueTaskReservationsRequest> entry : requests.entrySet()) {
// For each entry, try to assign the tasks. Once all tasks have been assigned, cancel the
// remaining reservations.
THostPort hostPort = Network.socketAddressToThrift(entry.getKey());
// If the request has been cancelled, remove the current node monitor from the
// cancellations set, so we can check at the end that the cancellations set is empty to
// ensure that the cancellations returned were correct.
if (cancellations != null) {
assertTrue(cancellations.contains(hostPort));