Unsuccessful use cases of scala.concurrent.blocking?

Regarding the third point in this accepted answer, are there any cases for which it would be pointless or bad to use blockingfor long-term computation, whether it be a CPU or an IO-linked one that is executed “inside” a Future?

+4
source share
2 answers

Depending on ExecutionContextyours Future.

It makes no sense:

ExecutionContext BlockContext, blocking . DefaultBlockContext, - . , , .

:

Scala ExecutionContext.Implicits.global ForkJoinPool, . , , blocking. , . , global . @dk14 , , , .


blocking , , , , . , .

blocking, , .

+4

blocking + ForkJoinPool , , ( , ). ForkJoinPool " ", MaxThreadCount; VisualVm. , ( ThreadPoolExecutor). , .

:

  • , 1/blocking_time, . .
  • , blocking{} ( ), , .
  • - (, , ).

P.S. blocking Await.result, . - Await - .

+4

All Articles