Java Reference
In-Depth Information
remote interface. However, you must be aware that these
alternatives change the semantics of the interaction from
pass-by-value to pass-by-reference. This can lead to subtle
errors in your code. It is best to use local EJBs, since the
behavior is controllable on a bean by bean basis, rather than
affecting the entire application server.
Use stateless session beans instead of stateful session beans
This makes your system more amenable to failover. Use the
HttpSession to store user-specific state.
A stateful session bean is exactly the same, architecturally, as
a CORBA object a single object instance, tied to a single
server, which is dependent upon that server for its life. If the
server goes down, the object values are lost, and any clients
of that bean are thus out of luck.
Java EE application servers providing for stateful session
bean failover can work around some issues, but stateful
solutions are not as scalable as stateless ones. For example, in
Application Server, requests for stateless session beans are
load-balanced across all of the members of a cluster where a
stateless session bean has been deployed. In contrast,
application servers cannot load-balance requests to stateful
beans. This means load may be spread disproportionately
across the servers in your cluster. In addition, the use of
stateful session beans pushes state to your application server,
which is undesirable. Stateful session beans increase system
complexity and complicate failure scenarios. One of the key
principles of robust distributed systems is the use of stateless
behavior whenever possible.
Search WWH ::




Custom Search