diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-07-25 16:23:24 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-07-25 16:23:24 +0200 |
commit | 35a36ab8f965823b1165729564660f65b2836b44 (patch) | |
tree | 162593edde44600f3c40d86ca53e1eb9cf47ef9d /orchestrator | |
parent | 44c407da88f215331a07a90921bf7008c724eaab (diff) |
Use VespaJerseyJaxRsClient in cluster controller client factory
Diffstat (limited to 'orchestrator')
2 files changed, 13 insertions, 8 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactory.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactory.java index 33e74235862..4b82f278f23 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactory.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactory.java @@ -2,11 +2,11 @@ package com.yahoo.vespa.orchestrator.controller; import com.google.inject.Inject; +import com.yahoo.component.AbstractComponent; import com.yahoo.vespa.applicationmodel.HostName; -import com.yahoo.vespa.jaxrs.client.JaxRsClientFactory; import com.yahoo.vespa.jaxrs.client.JaxRsStrategy; import com.yahoo.vespa.jaxrs.client.JaxRsStrategyFactory; -import com.yahoo.vespa.jaxrs.client.JerseyJaxRsClientFactory; +import com.yahoo.vespa.jaxrs.client.VespaJerseyJaxRsClientFactory; import java.util.HashSet; import java.util.List; @@ -14,21 +14,21 @@ import java.util.List; /** * @author bakksjo */ -public class RetryingClusterControllerClientFactory implements ClusterControllerClientFactory { +public class RetryingClusterControllerClientFactory extends AbstractComponent implements ClusterControllerClientFactory { // TODO: Figure this port out dynamically. public static final int HARDCODED_CLUSTERCONTROLLER_PORT = 19050; public static final String CLUSTERCONTROLLER_API_PATH = "/"; public static final String CLUSTERCONTROLLER_SCHEME = "http"; - private JaxRsClientFactory jaxRsClientFactory; + private final VespaJerseyJaxRsClientFactory jaxRsClientFactory; @Inject public RetryingClusterControllerClientFactory() { - this(new JerseyJaxRsClientFactory()); + this(new VespaJerseyJaxRsClientFactory("orchestrator-cluster-controller-client")); } - public RetryingClusterControllerClientFactory(JaxRsClientFactory jaxRsClientFactory) { + RetryingClusterControllerClientFactory(VespaJerseyJaxRsClientFactory jaxRsClientFactory) { this.jaxRsClientFactory = jaxRsClientFactory; } @@ -50,4 +50,9 @@ public class RetryingClusterControllerClientFactory implements ClusterController .setMaxIterations(clusterControllers.size() > 1 ? 1 : 2); return new ClusterControllerClientImpl(jaxRsApi, clusterName); } + + @Override + public void deconstruct() { + jaxRsClientFactory.close(); + } } diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactoryTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactoryTest.java index f47b43fa27b..8d5110ac0b6 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactoryTest.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/controller/RetryingClusterControllerClientFactoryTest.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.orchestrator.controller; import com.yahoo.test.ManualClock; import com.yahoo.vespa.applicationmodel.HostName; -import com.yahoo.vespa.jaxrs.client.JaxRsClientFactory; +import com.yahoo.vespa.jaxrs.client.VespaJerseyJaxRsClientFactory; import com.yahoo.vespa.orchestrator.OrchestratorContext; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -27,7 +27,7 @@ public class RetryingClusterControllerClientFactoryTest { @Test public void verifyJerseyCallForSetNodeState() throws IOException { - JaxRsClientFactory clientFactory = mock(JaxRsClientFactory.class); + VespaJerseyJaxRsClientFactory clientFactory = mock(VespaJerseyJaxRsClientFactory.class); ClusterControllerJaxRsApi api = mock(ClusterControllerJaxRsApi.class); when(clientFactory.createClient(any())).thenReturn(api); RetryingClusterControllerClientFactory factory = new RetryingClusterControllerClientFactory(clientFactory); |