Stateful versus stateless components

A component that can remain active between consecutive method invocations is called a stateful component. A component that is deactivated after each method call and that supports instance pooling is said to be a stateless component. Typically, an application built with stateless components offers the greatest scalability.

Stateful components A stateful component remains active across method calls. EAServer wraps stateful CORBA components with an EJB stateful session bean. To run a CORBA component as stateful, the Stateful Session Bean (com.sybase.jaguar.component.tx_vote) property must be set to true–see “CORBA component property descriptions”.

Since deactivation happens at the mercy of client applications, you may wish to configure the Passivation Timeout property for stateful components so that a client cannot monopolize a component instance indefinitely. See “CORBA component property descriptions” for more information.

Stateless components A is stateless if you disable the component’s Stateful Session Bean property (com.sybase.jaguar.component.tx_vote) —see Table 4-2. You can also set the component’s com.sybase.jaguar.component.tx_vote property to false in an Ant user configuration file. Alternatively, you can implement the component so that it calls either completeWork or rollbackWork in every method.:

Stateless components cannot use instance-specific data to accumulate data between method invocations. Some situations require that you accumulate data across method invocations. For example, a PurchaseOrder component might have an addItem() method that is called repeatedly to specify the contents of an order. In lieu of instance-specific data, you can use one of these alternatives to accumulate data: