Thread Pool Size #459
Answered
by
ryber
lf-jason-jia
asked this question in
Q&A
Thread Pool Size
#459
-
Do we have a way of changing the size the underlying thread pool? When I run this code, I got "2 2": @Test
void basic_unirest_sync() {
System.out.println(Thread.activeCount());
Object res = Unirest.get("https://reqres.in/api/users?page=2");
System.out.println(Thread.activeCount());
assertNotNull(res);
} But if I run the async version, I got "2 16": @Test
void basic_unirest_async() {
System.out.println(Thread.activeCount());
Object res = Unirest.get("https://reqres.in/api/users?page=2").asObjectAsync(Object.class).join();
System.out.println(Thread.activeCount());
assertNotNull(res);
} Please correct me if my understanding is incorrect but I think the whole point of using async is to minimize the use of threads while providing a non-blocking API? I assume an async task could be suspended and resumed so in theory we only need a couple of threads to offer an async API? |
Beta Was this translation helpful? Give feedback.
Answered by
ryber
Nov 18, 2022
Replies: 1 comment 3 replies
-
What version of Unirest are you using? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
lf-jason-jia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Unirest are you using?