Skip to content

Commit 604beab

Browse files
SLVS-2552 Reuse http client for different analysis (#18)
1 parent bdc5f5c commit 604beab

File tree

1 file changed

+2
-1
lines changed
  • sonarqube-ide-visualstudio-roslyn-plugin/src/main/java/org/sonarsource/sonarlint/visualstudio/roslyn/http

1 file changed

+2
-1
lines changed

sonarqube-ide-visualstudio-roslyn-plugin/src/main/java/org/sonarsource/sonarlint/visualstudio/roslyn/http/HttpClientHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@
3737
public class HttpClientHandler {
3838
private final SensorContext context;
3939
private final JsonRequestBuilder jsonRequestBuilder;
40+
private final HttpClient client;
4041

4142
public HttpClientHandler(SensorContext context, JsonRequestBuilder jsonRequestBuilder) {
4243
this.context = context;
4344
this.jsonRequestBuilder = jsonRequestBuilder;
45+
client = HttpClient.newHttpClient();
4446
}
4547

4648
public HttpResponse<String> sendRequest(Collection<String> fileNames, Collection<ActiveRule> activeRules, Map<String, String> analysisProperties, AnalyzerInfoDto analyzerInfo)
4749
throws IOException, InterruptedException {
48-
HttpClient client = HttpClient.newHttpClient();
4950
var jsonPayload = jsonRequestBuilder.buildBody(fileNames, activeRules, analysisProperties, analyzerInfo);
5051
var request = createRequest(jsonPayload);
5152
return client.send(request, HttpResponse.BodyHandlers.ofString());

0 commit comments

Comments
 (0)