rest
rest copied to clipboard
RxInvokerProvider API unnecessarily restrictive
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 CompletionStage
s.
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.
Seems reasonable to me +1