Skip to content

Commit 730cdc2

Browse files
committed
Finishing removing duplicate accessor method
1 parent abce1cd commit 730cdc2

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

java/server/src/org/openqa/selenium/grid/data/NodeStatus.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,10 @@ public long getLastSessionCreated() {
242242
.orElse(0);
243243
}
244244

245-
public Duration heartbeatPeriod() {
246-
return heartbeatPeriod;
247-
}
248-
249245
public void touch() {
250246
touched = System.currentTimeMillis();
251247
}
252248

253-
public long touched() {
254-
return touched;
255-
}
256-
257249
@Override
258250
public boolean equals(Object o) {
259251
if (!(o instanceof NodeStatus)) {

java/server/src/org/openqa/selenium/grid/distributor/gridmodel/local/LocalGridModel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ public void purgeDeadNodes() {
168168
writeLock.lock();
169169
try {
170170
Set<NodeStatus> lost = nodes(UP).stream()
171-
.filter(status -> now - status.touched() > status.getHeartbeatPeriod().toMillis() * 2)
171+
.filter(status -> now - status.getTouched() > status.getHeartbeatPeriod().toMillis() * 2)
172172
.collect(toSet());
173173
Set<NodeStatus> resurrected = nodes(DOWN).stream()
174-
.filter(status -> now - status.touched() <= status.getHeartbeatPeriod().toMillis())
174+
.filter(status -> now - status.getTouched() <= status.getHeartbeatPeriod().toMillis())
175175
.collect(toSet());
176176
Set<NodeStatus> dead = nodes(DOWN).stream()
177-
.filter(status -> now - status.touched() > status.getHeartbeatPeriod().toMillis() * 4)
177+
.filter(status -> now - status.getTouched() > status.getHeartbeatPeriod().toMillis() * 4)
178178
.collect(toSet());
179179
if (lost.size() > 0) {
180180
LOG.info(String.format(

java/server/src/org/openqa/selenium/grid/distributor/gridmodel/redis/RedisGridModel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,17 @@ public void purgeDeadNodes() {
153153
Set<NodeId> up = redisClient.getNodesByAvailability(UP);
154154
Set<NodeStatus> upNodes = redisClient.getNodes(up);
155155
Set<NodeStatus> lost = upNodes.stream()
156-
.filter(status -> now - status.touched() > status.heartbeatPeriod().toMillis() * 2)
156+
.filter(status -> now - status.getTouched() > status.getHeartbeatPeriod().toMillis() * 2)
157157
.collect(toSet());
158158

159159
Set<NodeId> down = redisClient.getNodesByAvailability(DOWN);
160160
Set<NodeStatus> downNodes = redisClient.getNodes(down);
161161
Set<NodeStatus> resurrected = downNodes.stream()
162-
.filter(status -> now - status.touched() <= status.heartbeatPeriod().toMillis())
162+
.filter(status -> now - status.getTouched() <= status.getHeartbeatPeriod().toMillis())
163163
.collect(toSet());
164164

165165
Set<NodeStatus> dead = downNodes.stream()
166-
.filter(status -> now - status.touched() > status.heartbeatPeriod().toMillis() * 4)
166+
.filter(status -> now - status.getTouched() > status.getHeartbeatPeriod().toMillis() * 4)
167167
.collect(toSet());
168168

169169
if (lost.size() > 0) {
@@ -425,7 +425,7 @@ public void amend(Availability availability, NodeStatus status, Slot slot) {
425425
status.getMaxSessionCount(),
426426
newSlots,
427427
status.getAvailability(),
428-
status.heartbeatPeriod(),
428+
status.getHeartbeatPeriod(),
429429
status.getVersion(),
430430
status.getOsInfo());
431431
redisClient.addNode(updatedStatus);
@@ -440,7 +440,7 @@ public NodeStatus rewrite(NodeStatus status, Availability availability) {
440440
status.getMaxSessionCount(),
441441
status.getSlots(),
442442
availability,
443-
status.heartbeatPeriod(),
443+
status.getHeartbeatPeriod(),
444444
status.getVersion(),
445445
status.getOsInfo());
446446
}

java/server/src/org/openqa/selenium/grid/router/GridStatusHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public HttpResponse execute(HttpRequest req) {
131131
.put("uri", node.getExternalUri())
132132
.put("maxSessions", node.getMaxSessionCount())
133133
.put("osInfo", node.getOsInfo())
134-
.put("heartbeatPeriod", node.heartbeatPeriod().toMillis())
134+
.put("heartbeatPeriod", node.getHeartbeatPeriod().toMillis())
135135
.put("availability", node.getAvailability())
136136
.put("version", node.getVersion())
137137
.put("slots", node.getSlots())

0 commit comments

Comments
 (0)