Stateless Session Bean Concepts

A stateless session bean is a lightweight version of a stateful session bean without the session-aware functionality. Because no state is maintained between a client application and a stateless session bean, the EJB-compliant container maintains an instance pool of stateless session beans. Any stateless session bean from the instance pool is used by the EJB container to service client application requests.

A stateless session bean can be used primarily for developing pure functionality or the business logic of the application. Stateless session beans are purely transactional in nature and can be used for embedding business logic that is reusable by different stateful session beans or client applications (see Figure 11.2).

Figure 11.2. Different client applications accessing stateless session beans.

graphics/11fig02.gif

Maintaining an instance pool of stateless session beans allows the EJB container to multiplex client application requests and service them with a relatively smaller number of stateless session beans. Moreover, because a stateless session does not need to be activated or passivated during its life cycle, relatively fewer resources of the EJB container are used up.

But the absence of maintaining a state by the stateless session bean comes at a price! The onus of maintaining state is pushed to the client application. This may result in the client application's becoming more complex than is desired from incorporating the logic of maintaining a session.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net