What's the benefit of using reactive programming over ExecutorService?

Vineeta :

If both are asynchronous in nature, then what's the use of using Reactive programming over ExecutorService in Java? In what ways reactive programming can be found effective as compared to ExecutorService?

Alexei Kaigorodov :

Asynchronous programming usually includes some kinds of task interaction. Different kinds of asynchronous programming provide different kinds of task interaction.

ExecutorService executes submitted tasks as soon as there exists available processor, that is, it provides only simplest form of asynchronous programming, without task interaction at all.

Reactive programming provides channels to exchange messages with backpressure, which is quite advanced kind of task interaction. But under the hood, it still uses an ExecutorService.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=121052&siteId=1