Stateful versus stateless components

A component that remains bound to a client instance between consecutive method invocations is called a stateful component. A component that can be unbound from the client after each method call is said to be a stateless component. Typically, an application built with stateless components offers the greatest scalability. In the stateless model, each instance can serve different clients during the “think time” that is typically seen in interactive applications. In the stateful model, each client requires a dedicated component instance for the lifetime of the client session.

You can either configure stateless behavior, or code the component to call the appropriate lifecycle control method to unbind the component instance from the client reference in each business method. For more information, see “Component lifecycles” in the EAServer Programmer’s Guide for more information.

The stateless model requires an implementation that supports stateless execution. For example, if your component requires two subsequent invocations to compute a result for the client, it will break if you change the component properties to enable stateless behavior.

If you use stateful components, configure the Instance Timeout setting on the Component properties: Resources tab in EAServer Manager or by setting the com.sybase.jaguar.component.timeout property with jagtool. This setting limits the time that an instance can be bound to a client session.