简体   繁体   English

RestEasy:处理并发请求

[英]RestEasy: Handling concurrent requests

I need to know the details how rest easy with jBoss handles multiple concurrent request for a webservice. 我需要知道详细信息,jBoss如何轻松处理Web服务的多个并发请求。 For example I have made a webservice, which downloads a particular file. 例如,我制作了一个Web服务,该服务下载一个特定的文件。 I need to check how the system will behave if say 100 or more people hit the service at the same time. 我需要检查如果说100个或更多的人同时点击该服务,系统将如何运行。

Is Resteasy framework handling own its own in multithreading or that needs to handled at our end. Resteasy框架是在多线程中自己处理还是在我们最后需要处理。 Or will the server handle it? 还是服务器会处理?

RestEasy is an implementation of the JAX-RS specification. RestEasy是JAX-RS规范的实现。 According to JAX-RS for every new HTTP Request a new Rest Resource class is by default constructed (exceptions are eg when you are inside other frameworks like Spring, which is very unlikely). 根据JAX-RS,对于每个新的HTTP请求,默认情况下都会构造一个新的Rest Resource类(例如,当您在其他类似Spring之类的框架中时,例外情况是不太可能的)。 Given that said, you are guaranteed that your code (actually state) in Rest Resources is thread-safe. 鉴于以上所述,可以保证Rest Resources中的代码(实际上是状态)是线程安全的。 But if you have some other code deeper, like something stored in your HTTP session, or some services that are used in your Rest Resources (directly or indirectly), then it is your task to make it thread-safe. 但是,如果您还有其他更深层的代码,例如存储在HTTP会话中的代码,或者(直接或间接)在Rest资源中使用的某些服务,那么使它成为线程安全是您的任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM