In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the example analysis of bean in EJB. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
The most important part of EJB: three bean.
Beginning: all three bean should implement their own interfaces, and the message driver should implement not only the MessageDrivenBean interface, but also the MessageListener interface. Both session and entity bean have corresponding home and component interfaces, while message drivers do not. Because message-driven bean has no customers.
Conversation bean: there are two types, one is stateful, the other is stateless. Stateful bean is passivated and activated, while stateless bean is not. Because stateless does not know who his customer is, there is no need to keep customer information, when his mission is completed, he returns to the pool, while stateful bean retains customer information, but if the customer does not call bean's business methods for a long time, bean in the container will greatly affect efficiency, so there is passivation and activation. When ejbPassivate () completes, each non-temporary instance variable must be serializable or primitive, or null, or a reference to something special that the container must handle.
The process of creating a stateful and stateless session bean is also very different. Let's talk about the state first.
1. The customer invokes the creation method on home.
2. The container establishes the EJB object and SessionContext.
3. The container constructs a bean instance.
4. The container connects bean to its context and EJB objects (calling setSessionContext () and ejbCreate ()).
5. The container sends a stake of the EJB object to the customer.
The next step is stateless, stateless session bean creation independent of the customer. Stateless creation is detached from the client calling the creation method. When the customer invokes the create method on home, all the container has to do is pull a bean out of the pool and connect it to the customer's EJB object. When the business method on bean is called, the container sends the bean back to the pool.
This is the end of this article on "sample Analysis of bean in EJB". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.