What is the purpose of asynchronous JAX-RS

后端 未结 3 883
感动是毒
感动是毒 2021-01-31 22:12

I\'m reading \"RESTful Java with JAX-RS 2.0\" book. I\'m completely confused with asynchronous JAX-RS, so I ask all questions in one. The book writes asynchronous server like th

3条回答
  •  囚心锁ツ
    2021-01-31 22:31

    I share your view expressed in question 1. Let me just add a little detail that the webserver thread doesn't die, it typically comes from a pool and frees itself for another web request. But that doesn't really change much in terms of efficiency of async processing. In those examples, async processing is merely used to pass the processing from one thread pool to another. I don't see any point at all in that.

    But there is one use-case where I think async makes sense, eg. when you want to register multiple clients to wait for an event and send a response to all of them once the event occurs. It is described in this article: http://java.dzone.com/articles/whats-new-jax-rs-20

提交回复
热议问题