diff options
author | Håkon Hallingstad <hakon@verizonmedia.com> | 2020-10-10 15:26:08 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@verizonmedia.com> | 2020-10-10 15:26:08 +0200 |
commit | 805abcff704b2d2f8ae24dcebdad500cc7a658d3 (patch) | |
tree | 7aa1575f87334ef0d10a6a5f37115db96abd5b8c /container-core/src/test/java/com/yahoo/container/handler | |
parent | c93bdaf18df6ab5f1d524d9a9e63644c86ec5675 (diff) |
Take StateMonitor snapshot every 60s
Using Executors simplifies the code and fixes the following 2 small problems:
- A tiny drift of the 1m interval: It starts the next snapshot 1m + the time
before wait() return + the time until currentTimeMillis().
- May potentially (but unlikely) invoke wait() with negative (throws
exception) or 0 argument (waits forever): There is no test on the returned
long from currentTimeMillis().
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/handler')
-rw-r--r-- | container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java b/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java index e7a9a1442f3..d26d7f7f013 100644 --- a/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java +++ b/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java @@ -1,14 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.container.handler; -import static org.junit.Assert.*; - import com.yahoo.container.QrSearchersConfig; import com.yahoo.container.core.VipStatusConfig; import com.yahoo.container.jdisc.state.StateMonitor; import com.yahoo.jdisc.core.SystemTimer; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + /** * @author bratseth */ @@ -142,7 +144,7 @@ public class VipStatusTestCase { Thread thread = new Thread(runnable, "StateMonitor"); thread.setDaemon(true); return thread; - }); + }, true); } private static void removeFromRotation(String[] clusters, VipStatus v) { |