This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String request_1() throws Exception { | |
| String resultNum = requestService("http://localhost:8080/1"); | |
| return request_2(resultNum); | |
| } | |
| String request_2(String num) throws Exception { | |
| String resultNum = requestService("http://localhost:8080/" + num); | |
| return request_3(resultNum); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package test.sample; | |
| import java.util.Arrays; | |
| import java.util.Objects; | |
| /** | |
| * How does a record handle arrays in equals and hashCode? | |
| * | |
| * @author nick | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.URI; | |
| import java.net.http.HttpClient; | |
| import java.net.http.HttpClient.Redirect; | |
| import java.net.http.HttpRequest; | |
| import java.net.http.HttpResponse.BodyHandlers; | |
| public class HttpClientExample { | |
| public static void main(String[] args) throws Exception { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.concurrent.ForkJoinPool; | |
| import java.util.concurrent.ForkJoinTask; | |
| public class ForkJoinTaskDemo { | |
| public static void main(String[] args) throws Exception { | |
| ForkJoinPool pool = ForkJoinPool.commonPool(); | |
| System.out.println("Pool size: " + pool.getParallelism()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.TimeUnit; | |
| public class ThreadPoolExceptionExample { | |
| public static void main(String[] args) throws Exception { | |
| ExecutorService pool = Executors.newFixedThreadPool(1); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import static java.nio.charset.StandardCharsets.UTF_8; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.OutputStreamWriter; | |
| import java.io.Reader; | |
| import java.net.URI; | |
| import java.nio.channels.Channels; |