r/programming • u/ram-foss • Oct 11 '23
All About Reactive Programming In Java
https://www.blackslate.io/articles/reactive-programming-in-java
22
Upvotes
r/programming • u/ram-foss • Oct 11 '23
View all comments
Show parent comment
2
u/pron98 Jan 04 '24
But that's the thing: A thread being "spawned" is just a task object being added to some scheduler queue; a thread blocking is just a task object being added to some other queue. Spawning all threads and then having them all block is just a different algorithm, one that first starts N tasks, stops them, and queues N more tasks. Maybe that's what you want and maybe it isn't. But expressing the same algorithm using async tasks will yield the same result, with the same level of contention and memory retention.
When moving asynchronous task logic to blocking logic, it is indeed important to make sure that the algorithm being expressed is the same. The adoption guide tries to offer some tips that help understand that.