* BAEL-1412 add java 8 spring data features

* BAEL-21 new HTTP API overview

* BAEL-21 fix executor
This commit is contained in:
abialas 2018-02-04 23:44:22 +01:00 committed by maibin
parent 8ada19dafe
commit 84782d054e
1 changed files with 6 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -116,18 +117,20 @@ public class HttpClientTest {
.GET() .GET()
.build(); .build();
ExecutorService executorService = Executors.newFixedThreadPool(2);
CompletableFuture<HttpResponse<String>> response1 = HttpClient.newBuilder() CompletableFuture<HttpResponse<String>> response1 = HttpClient.newBuilder()
.executor(Executors.newFixedThreadPool(2)) .executor(executorService)
.build() .build()
.sendAsync(request, HttpResponse.BodyHandler.asString()); .sendAsync(request, HttpResponse.BodyHandler.asString());
CompletableFuture<HttpResponse<String>> response2 = HttpClient.newBuilder() CompletableFuture<HttpResponse<String>> response2 = HttpClient.newBuilder()
.executor(Executors.newFixedThreadPool(2)) .executor(executorService)
.build() .build()
.sendAsync(request, HttpResponse.BodyHandler.asString()); .sendAsync(request, HttpResponse.BodyHandler.asString());
CompletableFuture<HttpResponse<String>> response3 = HttpClient.newBuilder() CompletableFuture<HttpResponse<String>> response3 = HttpClient.newBuilder()
.executor(Executors.newFixedThreadPool(2)) .executor(executorService)
.build() .build()
.sendAsync(request, HttpResponse.BodyHandler.asString()); .sendAsync(request, HttpResponse.BodyHandler.asString());