Chapter 8 Creating J2EE Applications for BEA WebLogic


Session EJBs in a Cluster

The sections that follow describe cluster capabilities and limitations for different EJB types.

Stateless Session EJBs

Stateless session EJBs can have both a cluster-aware home stub and a replica-aware EJBObject stub. By default, WebLogic Server provides failover services for EJB method calls, but only if a failure occurs between method calls. For example, failover is automatically supported if there is a failure after a method completes, or if the method fails to connect to a server. When failures occur while an EJB method is in progress, WebLogic Server does not automatically failover from one server to another.

This default behavior ensures that database updates within an EJB method are not "duplicated" due to a failover scenario. For example, if a client calls a method that increments a value in a datastore and WebLogic Server fails over to another server before the method completes, the datastore would be updated twice for the client's single method call.

If methods are written in such a way that repeated calls to the same method do not cause duplicate updates, the method is said to be "idempotent." For idempotent methods, WebLogic Server provides the stateless-bean-methods-are-idempotent deployment property. If you set this property to "true" in weblogic-ejb-jar.xml, WebLogic Server assumes that the method is idempotent and will provide failover services for the EJB method, even if a failure occurs during a method call.

Stateful Session EJBs

Stateful session EJBs can utilize cluster-aware home stubs by setting home-is-clusterable to "true." This provides failover and load balancing for stateful EJB lookups. Stateful session EJBs configured this way use replica-aware EJBObject stubs. For more information on in-memory replication for stateful session EJBs, see In-Memory Replication for Stateful Session EJBs.

Entity EJBs in a Cluster

As with all EJB types, entity EJBs can utilize cluster-aware home stubs by setting home-is-clusterable to "true."

Read-Write Entity EJBs in a Cluster

read-write entity EJBs in a cluster behave similarly to entity EJBs in a non-clustered system, in that:


read-write entity EJBs supports automatic failover on a safe exception, if home-is-clusterable is set to true. For example, failover is automatically supported if there is a failure after a method completes, or if the method fails to connect to a server.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.