Bean的区别

本文探讨了消息驱动Bean与无状态会话Bean之间的主要区别。消息驱动Bean处理多个JMS消息的方式是异步的,并且不提供home或远程接口,只能通过向JMS队列或主题发送消息间接进行交互。而无状态会话Bean则用于处理一系列方法调用。此外,文章还详细介绍了两者在实例创建、生命周期管理和交互方式上的不同。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[color=red]What is the difference between Message Driven Beans and Stateless Session beans?[/color]
消息驱动的Bean和无状态的会话Bean有什么区别?

[color=red]In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call.[/color]
在一些情况下,动态的创建,分配消息驱动的Bean的实例与无状态的会话Bean很类似,它只存在于特定的方法调用期间。

[color=red]However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways:[/color]
但是,消息驱动的Bean与无状态的会话Bean(包括其它类型的EJB)有一些显著的不同:

[color=red]Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls.[/color]
消息驱动的Bean处理多个JMS消息是异步的,而不是方法调用的顺序的。

[color=red]Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients.[/color]
消息驱动的Bean没有home和远程接口,所以不能在内部或者外部的客户端直接使用。

[color=red]Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic.[/color]
客户端与消息驱动的Bean交互,只能非直接的,通过发送一个消息给JMS队列或者主题。

[color=red]Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary.[/color]
只有容器可以直接与消息驱动的Bean交互,创建bean的实力,传递JMS消息给那些需要的实例。

[color=red]The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.[/color]
容器管理者消息驱动的Bean的整个生命周期,实例不能被客户的请求或者其它API的调用而创建或者移除。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值