In the Component-Base and N-Tier trend, stateless objects play an important role. Stateless objects are the product of combining OO and Transaction Service technologies. OO technology emphasizes felxibility, reusability, and distribution. Transaction Service technology emphasizes performance and scalability ).
Stateless objects are an important pillar of the combination of these two technologies.
Most traditional OO technologies focus on Stateful objects. However, in today's MiddleWare (such as EJB and COM ++/MTS), Stateless objects are much higher than Stateful objects. Stateless plays an important role, especially in the EJB architecture. For example, the Stateless Session object does not need to store its own status values for a long time or belong to a specific user (client), so it occupies very few server resources, because it does not belong to a specific user, many EJB objects can share a few Stateless objects.
Features of Stateless objects
As far as the Client is concerned, the external behavior of the server object is concerned, and the behavior has nothing to do with the state of the object. Therefore, the client object does not need to care about the changes in the object state, rather than being stateless. For example, the stateless restriction does not mean that session beans of stateless cannot have attribute variables. Therefore, these session beans have their own internal states. However, the client does not see these internal states.
In the Internet era, scalability of information systems is extremely important, and the premise of high scalability is that Server resources must be effectively used, the resource sharing of stateless objects greatly reduces the server load. Therefore, when developing the N-Tier system, using Stateless objects is one of the skills required by system developers.
Use Stateless to support transactions
When the number of clients in the enterprise information system increases significantly, the shared resources that each Client can enjoy will naturally become more scarce. In the face of this problem, in addition to investing more resources, it is also an important solution to coordinate well to avoid resource waste and achieve full sharing.
Among them, the database is the most typical rare shared resource, and the transaction is a reliable technology to coordinate this shared resource. With the addition of Stateless objects, the transaction will be more powerful-more effective use of the database connection, and across different databases (that is, distributed transactions ).
Transactions are events of business transactions or changes ). Once an event occurs, the enterprise information system will participate in a series of processes, which will lead to a series of changes to shared resources (such as database data. To prevent other transactions from interfering with the change process, and to ensure exceptional handling (such as roll back) during the change process ), transactions have become a tool for managing and coordinating shared resources.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.