summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2020-05-27 11:27:16 +0200
committerValerij Fredriksen <valerijf@verizonmedia.com>2020-05-27 11:27:16 +0200
commit9d056d05c4b37f41e46e7a8a2a62794952c26498 (patch)
tree71ecba0e094e0b3384400e31987a87fc4504f1a9 /node-admin
parentf9fdcc763aa61a57ebe036664fe2a58b2e922164 (diff)
Simplify
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java9
1 files changed, 1 insertions, 8 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java
index a86b3865452..808a63eb130 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextManager.java
@@ -22,7 +22,6 @@ public class NodeAgentContextManager implements NodeAgentContextSupplier, NodeAg
private boolean wantFrozen = false;
private boolean isFrozen = true;
private boolean pendingInterrupt = false;
- private boolean waitingForContext = false;
public NodeAgentContextManager(Clock clock, NodeAgentContext context) {
this.clock = clock;
@@ -32,9 +31,6 @@ public class NodeAgentContextManager implements NodeAgentContextSupplier, NodeAg
@Override
public void scheduleTickWith(NodeAgentContext context, Instant at) {
synchronized (monitor) {
- // Do not schedule a new context while NodeAgent is still converging
- if (!waitingForContext) return;
-
nextContext = Objects.requireNonNull(context);
nextContextAt = Objects.requireNonNull(at);
monitor.notifyAll(); // Notify of new context
@@ -65,14 +61,13 @@ public class NodeAgentContextManager implements NodeAgentContextSupplier, NodeAg
@Override
public NodeAgentContext nextContext() throws InterruptedException {
synchronized (monitor) {
- waitingForContext = true;
+ nextContext = null; // Reset any previous context and wait for the next one
Duration untilNextContext = Duration.ZERO;
while (setAndGetIsFrozen(wantFrozen) ||
nextContext == null ||
(untilNextContext = Duration.between(Instant.now(), nextContextAt)).toMillis() > 0) {
if (pendingInterrupt) {
pendingInterrupt = false;
- waitingForContext = false;
throw new InterruptedException("interrupt() was called before next context was scheduled");
}
@@ -82,8 +77,6 @@ public class NodeAgentContextManager implements NodeAgentContextSupplier, NodeAg
}
currentContext = nextContext;
- nextContext = null;
- waitingForContext = false;
return currentContext;
}
}