diff options
author | Håkon Hallingstad <hakon@yahoo-inc.com> | 2017-06-16 09:30:14 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahoo-inc.com> | 2017-06-16 09:30:14 +0200 |
commit | 9d7a253953e0ed7fa8304634b0456444d4423189 (patch) | |
tree | 0ea5736dab35053df291875f868c2ac4fa277a87 /node-admin | |
parent | d1b348b781812bc8cabb15eb2fb93c6742e85b25 (diff) |
Use Duration instead of long
Diffstat (limited to 'node-admin')
2 files changed, 3 insertions, 3 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java index a0ac7fa00b4..b0bb5d1b7b1 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java @@ -30,7 +30,7 @@ import static com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdminStateUpdater. * @author dybis, stiankri */ public class NodeAdminStateUpdater extends AbstractComponent { - public static final long FREEZE_CONVERGENCE_TIMEOUT_MINUTES = 5; + public static final Duration FREEZE_CONVERGENCE_TIMEOUT = Duration.ofMinutes(5); private final AtomicBoolean terminated = new AtomicBoolean(false); private State currentState = SUSPENDED_NODE_ADMIN; @@ -135,7 +135,7 @@ public class NodeAdminStateUpdater extends AbstractComponent { if (wantedState != RESUMED && !converged) { Duration subsystemFreezeDuration = nodeAdmin.subsystemFreezeDuration(); - if (subsystemFreezeDuration.compareTo(Duration.ofMinutes(FREEZE_CONVERGENCE_TIMEOUT_MINUTES)) > 0) { + if (subsystemFreezeDuration.compareTo(FREEZE_CONVERGENCE_TIMEOUT) > 0) { // We have spent too long time trying to freeze and node admin is still not frozen. // To avoid node agents stalling for too long, we'll force unfrozen ticks now. logger.info("Timed out trying to freeze, will force unfreezed ticks"); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java index eacb702e24a..d68095e770a 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java @@ -107,7 +107,7 @@ public class NodeAdminStateUpdaterTest { // The second orchestration failure happens after the freeze convergence timeout, // and so SHOULD call setFrozen(false) when(nodeAdmin.setFrozen(eq(true))).thenReturn(true); - when(nodeAdmin.subsystemFreezeDuration()).thenReturn(Duration.ofMinutes(NodeAdminStateUpdater.FREEZE_CONVERGENCE_TIMEOUT_MINUTES + 1)); + when(nodeAdmin.subsystemFreezeDuration()).thenReturn(NodeAdminStateUpdater.FREEZE_CONVERGENCE_TIMEOUT.plusMinutes(1)); doThrow(new RuntimeException("Cannot allow to suspend because some reason")).doNothing() .when(orchestrator).suspend(eq(parentHostname), eq(suspendHostnames)); tickAfter(35); |