BAEL-21 (#3587)
* BAEL-1412 add java 8 spring data features * BAEL-21 new HTTP API overview * BAEL-21 fix executor
This commit is contained in:
parent
8ada19dafe
commit
84782d054e
|
@ -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());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue