servlet 中 ejb3 注入的并发含义是什么?

发布于 2024-11-14 08:21:22 字数 97 浏览 3 评论 0原文

我想将 ejb3 注入与 jndi 查找方法进行对比,注入是否将代理的 1 个特定实例绑定到 servlet?如果是这样,那么在集群环境中,如此严格的运行时绑定可能会导致效率低下。

i want to contrast ejb3 injection with the jndi lookup method, does injection bind 1 particular instance of proxy to the servlet ?? If so , then in a clustered environment such tight runtime binding could lead to inefficiencies .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执手闯天涯 2024-11-21 08:21:22

对于无状态,EJB 代理与其支持实例(通常是池化的)是一对多的,并且可以安全地注入到 servlet 中。

对于 Singleton,EJB 代理与其支持实例是一对一的,但容器(或 bean)负责确保并发调用是安全的还是不允许的,具体取决于每个方法的业务逻辑。 @AccessTimeout 可用于控制等待锁的时间。

对于有状态,EJB 代理与其支持实例是一对一的,并且不能安全地注入到 servlet 中。从 EJB 3.1 开始,有状态会话 bean 并发性提供了一定的安全性,但由于有状态会话 bean 超时,将有状态会话 bean 注入到 servlet 中不太可能有用。

For Stateless, an EJB proxy is 1-to-many with its backing instances (usually pooled) and is safe to inject into a servlet.

For Singleton, an EJB proxy is 1-to-1 with its backing instance, but the container (or bean) is responsible for ensuring the concurrent calls are either safe or disallowed, depending on business logic of each method. @AccessTimeout can be used to control how long to wait for a lock.

For Stateful, an EJB proxy is 1-to-1 with its backing instance and is not safe to inject into a servlet. As of EJB 3.1, stateful session bean concurrency allows some safety, but due to stateful session bean timeouts, injecting a stateful session bean into a servlet is unlikely to ever be useful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文