为什么无状态EJB是集合的? [英] Why Stateless EJBs are pooled?

查看:89
本文介绍了为什么无状态EJB是集合的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可以理解,控制应用程序的工作负载是非常有用的,用于收集调用,但是这仅仅是将服务器作为FAÇADE的EJB与调用者客户端的汇总合法化。



是否有任何好处来集中内部EJB(那些没有暴露的EJB在内部调用执行业务逻辑)?而不是使用一个共享的单一实例(如Spring)。



我可以考虑至少一个缺点:高度使用的内部EJB可能会成为瓶颈。 p>

解决方案

无状态会话bean EJB不一定是线程安全的。他们可以持有资源,如JMS会话,一次无法与多个线程共享,因此服务器将对它们进行汇总,以便它可以同时为同一个bean提供多个请求(JMS资源也是池,但我只是以此为例)。


What is the reason why the Application Servers pool the Stateless EJBs?

I can understand that it is usefull to control the workload of the application for incomming invokations, but this only justifies the pooling of the EJBs that server as FAÇADE with the invoker client.

Does it have any benefit to pool the internal EJBs (those that are not exposed and only invoked internally to perform business logic)?? instead of use a shared single instance (like Spring does).

I can think about at least one downside: a highly used internal EJB could act as a bottleneck.

解决方案

Stateless session bean EJBs are not necessarily thread-safe. They can be holding resources like JMS sessions which cannot be shared with more than one thread at a time so the server will pool them so that it can serve multiple requests for the same bean concurrently (JMS resources are also pooled, but I'm just using that for the sake of example).

这篇关于为什么无状态EJB是集合的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆