diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-05-12 21:33:22 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-05-12 21:35:08 +0000 |
commit | cf214d62e2eaba0b413feec0fc525142698a8fda (patch) | |
tree | b38184c06a7d5ece08fed2e09608824a25b5f963 /documentapi/src/test | |
parent | 86cfc2945d4711d47e224a6338372d11abe7e9f3 (diff) |
Use syncronized to make the loadbalancer semantically thread safe.
Use a cache to avoid parsing a string to get an index.
Move test to same package to avoid public access to internal details.
Diffstat (limited to 'documentapi/src/test')
-rw-r--r-- | documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerTestCase.java (renamed from documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/LoadBalancerTestCase.java) | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/LoadBalancerTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerTestCase.java index 51dd1ac12b8..dc96fcaf45d 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/LoadBalancerTestCase.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/LoadBalancerTestCase.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.documentapi.messagebus.protocol.test; +package com.yahoo.documentapi.messagebus.protocol; -import com.yahoo.documentapi.messagebus.protocol.LoadBalancer; import com.yahoo.jrt.slobrok.api.Mirror; import org.junit.Test; @@ -54,13 +53,13 @@ public class LoadBalancerTestCase { assertEquals("foo/" + (i % 3) + "/default" , node.entry.getName()); } - assertEquals(33, weights.get(0).sent.intValue()); - assertEquals(33, weights.get(1).sent.intValue()); - assertEquals(33, weights.get(2).sent.intValue()); + assertEquals(33, weights.get(0).sent); + assertEquals(33, weights.get(1).sent); + assertEquals(33, weights.get(2).sent); - weights.get(0).sent.set(0); - weights.get(1).sent.set(0); - weights.get(2).sent.set(0); + weights.get(0).sent = 0; + weights.get(1).sent = 0; + weights.get(2).sent = 0; } { |