question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document ForkJoinPool.managedBlock() usage example

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JakeWhartoncommented, Jan 20, 2020

The call is allocation-free for non-FJP theads, if memory serves.

0reactions
yschimkecommented, Mar 29, 2020

Won’t fix. Probably deserves a canonical stackoverflow post. I’ll upvote.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found