Skip to content

Commit

Permalink
[grid] Might as well call an ID an ID
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 29, 2020
1 parent fa8b0fa commit 33cc6cb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Expand Up @@ -83,7 +83,7 @@ public boolean hasCapacity(Capabilities caps) {
return count > 0;
}

public NodeId getNodeId() {
public NodeId getId() {
return nodeId;
}

Expand Down
Expand Up @@ -62,7 +62,7 @@ public HttpResponse execute(HttpRequest req) {
Node node = new RemoteNode(
tracer,
httpFactory,
status.getNodeId(),
status.getId(),
status.getUri(),
registrationSecret,
status.getSlots().stream().map(Slot::getStereotype).collect(Collectors.toSet()));
Expand Down
Expand Up @@ -145,7 +145,7 @@ private void refresh(NodeStatus status) {
writeLock.lock();
try {
Optional<Host> existingByNodeId = hosts.stream()
.filter(host -> host.getId().equals(status.getNodeId()))
.filter(host -> host.getId().equals(status.getId()))
.findFirst();

if (existingByNodeId.isPresent()) {
Expand All @@ -168,7 +168,7 @@ private void refresh(NodeStatus status) {
Node node = new RemoteNode(
tracer,
clientFactory,
status.getNodeId(),
status.getId(),
status.getUri(),
registrationSecret,
status.getSlots().stream().map(Slot::getStereotype).collect(Collectors.toSet()));
Expand Down
Expand Up @@ -58,7 +58,7 @@ public Set<SlotId> selectSlot(Capabilities capabilities, Set<NodeStatus> nodes)
// Then last session created (oldest first), so natural ordering again
.thenComparingLong(NodeStatus::getLastSessionCreated)
// And use the node id as a tie-breaker.
.thenComparing(NodeStatus::getNodeId))
.thenComparing(NodeStatus::getId))
.flatMap(node -> node.getSlots().stream()
.filter(slot -> !slot.getSession().isPresent())
.filter(slot -> slot.isSupporting(capabilities))
Expand Down
Expand Up @@ -204,12 +204,12 @@ public void distributorShouldUpdateStateOfExistingNodeWhenNodePublishesStateChan
// Craft a status that makes it look like the node is busy, and post it on the bus.
NodeStatus status = node.getStatus();
NodeStatus crafted = new NodeStatus(
status.getNodeId(),
status.getId(),
status.getUri(),
status.getMaxSessionCount(),
ImmutableSet.of(
new Slot(
new SlotId(status.getNodeId(), UUID.randomUUID()),
new SlotId(status.getId(), UUID.randomUUID()),
CAPS,
Instant.now(),
Optional.of(new Session(new SessionId(UUID.randomUUID()), sessionUri, CAPS, CAPS, Instant.now())))),
Expand Down

0 comments on commit 33cc6cb

Please sign in to comment.