Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit a65c307

Browse files
committed
After review fixes
1 parent 7e7f4f8 commit a65c307

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

config-scalecube-configuration-service/src/main/java/io/scalecube/config/service/ScalecubeConfigurationServiceConfigSource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class ScalecubeConfigurationServiceConfigSource implements ConfigSource {
3131
private static final Logger LOGGER =
3232
LoggerFactory.getLogger(ScalecubeConfigurationServiceConfigSource.class);
3333

34+
private static final ServiceCall serviceCall = new ServiceCall();
35+
3436
private final ConfigurationService service;
3537

3638
private final ReadListRequest requestEntries;
@@ -120,7 +122,7 @@ public Builder url(URL url) {
120122
* @return service
121123
*/
122124
public static <T> T httpService(GatewayClientSettings settings, Class<T> clazz) {
123-
return new ServiceCall()
125+
return serviceCall
124126
.transport(new GatewayClientTransport(new HttpGatewayClient(settings, HTTP_CLIENT_CODEC)))
125127
.router(new StaticAddressRouter(Address.create(settings.host(), settings.port())))
126128
.api(clazz);

scalecube-configuration-benchmarks/src/main/java/io/scalecube/configuration/benchmarks/ConfigurationServiceBenchmarkState.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ final class ConfigurationServiceBenchmarkState
5050
private final String gatewayProtocol;
5151
private final boolean secure;
5252

53+
private final ServiceCall serviceCall;
54+
5355
private final AtomicReference<String> apiKey = new AtomicReference<>();
5456

5557
/**
@@ -65,6 +67,11 @@ public ConfigurationServiceBenchmarkState(BenchmarkSettings settings) {
6567
gatewayPort = Integer.valueOf(settings.find("gatewayPort", "7070"));
6668
gatewayProtocol = String.valueOf(settings.find("gatewayProtocol", "ws"));
6769
secure = Boolean.valueOf(settings.find("secure", "false"));
70+
71+
serviceCall =
72+
new ServiceCall()
73+
.transport(clientTransport())
74+
.router(new StaticAddressRouter(Address.create(gatewayHost, gatewayPort)));
6875
}
6976

7077
@Override
@@ -129,10 +136,7 @@ private GatewayClientTransport clientTransport() {
129136
}
130137

131138
protected <T> T forService(Class<T> clazz) {
132-
return new ServiceCall()
133-
.transport(clientTransport())
134-
.router(new StaticAddressRouter(Address.create(gatewayHost, gatewayPort)))
135-
.api(clazz);
139+
return serviceCall.api(clazz);
136140
}
137141

138142
private void preload(Token token, int configKeysCount) {

scalecube-configuration/src/test/java/io/scalecube/configuration/fixtures/IntegrationEnvironmentFixture.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,33 @@
1616
public final class IntegrationEnvironmentFixture implements Fixture {
1717

1818
private static final IntegrationEnvironment environment = new IntegrationEnvironment();
19+
private static String HOST = "localhost";
20+
private static int PORT = 7070;
21+
22+
private ServiceCall serviceCall;
1923

2024
static {
2125
environment.start();
2226
}
2327

2428
private GatewayClient client;
2529
private GatewayClientTransport clientTransport;
26-
private String HOST = "localhost";
27-
private int PORT = 7070;
2830

2931
@Override
3032
public void setUp() throws TestAbortedException {
3133
GatewayClientSettings settings = GatewayClientSettings.builder().host(HOST).port(PORT).build();
3234

3335
client = new WebsocketGatewayClient(settings, WEBSOCKET_CLIENT_CODEC);
3436
clientTransport = new GatewayClientTransport(client);
37+
serviceCall =
38+
new ServiceCall()
39+
.transport(clientTransport)
40+
.router(new StaticAddressRouter(Address.create(HOST, PORT)));
3541
}
3642

3743
@Override
3844
public <T> T proxyFor(Class<? extends T> clazz) {
39-
return new ServiceCall()
40-
.transport(clientTransport)
41-
.router(new StaticAddressRouter(Address.create(HOST, PORT)))
42-
.api(clazz);
45+
return serviceCall.api(clazz);
4346
}
4447

4548
@Override

0 commit comments

Comments
 (0)