如何删除 EJB2.1 无状态会话 bean

发布于 2024-09-28 03:33:52 字数 122 浏览 3 评论 0原文

大家好, 我有一个问题:如何删除 EJB 会话 bean(尤其是无状态 bean)?

当然有remove()方法,但是当会话对象处于事务中时不能调用它,即会话bean A在其业务方法中被另一个会话bean B调用。

Greetings all,
I have a question: How to remove an EJB session bean (especially Stateless beans) ?

There's of course remove() method, however it cannot be called while the session object is in transaction i.e. session bean A is called by another session bean B in it's business method.

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

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

发布评论

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

评论(1

浅笑依然 2024-10-05 03:33:52

无状态 bean 无法被客户端删除,事实上它们永远不会“消亡”,这是因为容器使用无状态会话 bean 池 em> 处理用户的请求。

仅当方法调用持续时,有状态 Bean 从池中取出并附加到客户端,之后,容器将其放回池中。奇怪的是,remove 方法仅适用于释放有状态 bean 和实体 bean 的资源,容器总是忽略无状态会话 bean 的remove 方法。

A Stateless bean can't be removed by the client, in fact they never "die", that's because the container uses a pool of stateless session beans to handle user's request.

A stateful bean is taken out from the pool and attached to a client only while the method call lasts, after that, the container put it back into the pool. Oddly, the remove method is only useful to realease resources for stateful and entity beans, the container always ignores the remove method for stateless session beans.

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