rest icon indicating copy to clipboard operation
rest copied to clipboard

RxInvokerProvider API unnecessarily restrictive

Open olotenko opened this issue 5 years ago • 1 comments

RxInvokerProvider.getRxInvoker receives a SyncInvoker. This makes no sense in modern world.

A consequence of this is that developers are enticed to use SyncInvoker interface, as is done by org/glassfish/jersey/client/JerseyCompletionStageRxInvoker.java, for example.

Proposal: update the API to require AsyncInvoker.

Expectation: RxInvoker should be as good as AsyncInvoker, just providing a better API with CompletionStages.

The issue here is that SyncInvoker can only start waiting for request in a thread, blocking the thread for the duration of the wait for response. AsyncInvoker is more suitable, since it allows to start using a thread only after the response started arriving. A well-designed system can work with asynchronous thread pool of CPU-count size. The use of SyncInvoker precludes that.

olotenko avatar Sep 10 '19 13:09 olotenko

Seems reasonable to me +1

spericas avatar Sep 10 '19 13:09 spericas