I want to convert mono to object java without using block()/blockFirst()/blockLast(). Please tell me the way to convert it.
The official path is block()
, which should serve as a warning that you may be doing something wrong, because blocking a non-blocking system is like shooting yourself in the foot.
In fact so much so that we recently forbid to do so on some of the non-blocking Schedulers
of Reactor by throwing an exception when using these APIs:
java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread parallel-1
If you really like to shoot yourself in the foot, there is always the antipattern solution of .toFuture().get()
... ¯\_(ツ)_/¯
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With