Fix #8492 - Use Vertx reference instead of static class (#8501)

This commit is contained in:
Ricardo Zanini 2021-01-28 04:26:42 -03:00 committed by GitHub
parent 5b82ed9407
commit e377eabbc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -123,10 +123,10 @@ public class ApiClient{{#java8}} extends JavaTimeFormatter{{/java8}} {
public synchronized WebClient getWebClient() {
String webClientIdentifier = "web-client-" + identifier;
WebClient webClient = Vertx.currentContext().get(webClientIdentifier);
WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier);
if (webClient == null) {
webClient = buildWebClient(vertx, config);
Vertx.currentContext().put(webClientIdentifier, webClient);
this.vertx.getOrCreateContext().put(webClientIdentifier, webClient);
}
return webClient;
}

View File

@ -112,10 +112,10 @@ public class ApiClient extends JavaTimeFormatter {
public synchronized WebClient getWebClient() {
String webClientIdentifier = "web-client-" + identifier;
WebClient webClient = Vertx.currentContext().get(webClientIdentifier);
WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier);
if (webClient == null) {
webClient = buildWebClient(vertx, config);
Vertx.currentContext().put(webClientIdentifier, webClient);
this.vertx.getOrCreateContext().put(webClientIdentifier, webClient);
}
return webClient;
}

View File

@ -115,10 +115,10 @@ public class ApiClient extends JavaTimeFormatter {
public synchronized WebClient getWebClient() {
String webClientIdentifier = "web-client-" + identifier;
WebClient webClient = Vertx.currentContext().get(webClientIdentifier);
WebClient webClient = this.vertx.getOrCreateContext().get(webClientIdentifier);
if (webClient == null) {
webClient = buildWebClient(vertx, config);
Vertx.currentContext().put(webClientIdentifier, webClient);
this.vertx.getOrCreateContext().put(webClientIdentifier, webClient);
}
return webClient;
}