Document ForkJoinPool.managedBlock() usage example
See original GitHub issueWhen a client performs a blocking call, I think it makes sense to wrap the very blocking operation with ForkJoinPool.managedBlock()
. Many clients make HTTP calls from a ForkJoinPool
and don’t wrap such calls with ForkJoinPool.managedBlock()
themselves.
Another reason why the library itself rather than the clients should do this is that the library is able to isolate the very blocking operation while doing some other operations (such as compression/decompression, if it happens to be performed in the application-layer thread) outside of ForkJoinPool.managedBlock()
. Also, if the response for the call is cached, ForkJoinPool.managedBlock()
could be avoided inside the OkHttp library.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:15 (5 by maintainers)
Top Results From Across the Web
ForkJoinPool.ManagedBlocker (Java Platform SE 7 )
Possibly blocks the current thread, for example waiting for a lock or condition. boolean, isReleasable(). Returns true if blocking is unnecessary.
Read more >java.util.concurrent.ForkJoinPool#managedBlock
The following examples show how to use java.util.concurrent.ForkJoinPool#managedBlock() . You can vote up the ones you like or vote down the ones you...
Read more >ForkJoinPool (Java Platform SE 7 )
Sample Usage. Normally a single ForkJoinPool is used for all parallel task execution in a program or subsystem. Otherwise, use would not usually...
Read more >ForkJoinPool.ManagedBlocker-Interface-java.util.concurrent ...
Method block() blocks the current thread if necessary (perhaps internally ... Some documents and sample code on this website are from third parties....
Read more >Applying the Java Fork-Join Framework's ManagedBlocker ...
... on blocking synchronizers &queues, based on examples from the JavaDoc documentation. ... The Java Fork-Join Pool Framework (Part 1).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The call is allocation-free for non-FJP theads, if memory serves.
Won’t fix. Probably deserves a canonical stackoverflow post. I’ll upvote.