Chapter 25 Managing Persistent Component State


Persistence for stateful components

Stateful components collect client session data over successive client method invocations. Normally, state data is stored in memory using fields in the implementation class. However, instances of a component coded this way can run on one server only, and cannot support load balancing or failover. Implementing the component to use persistent state allows instances to participate in failover and load balancing.

How it works

State data can be stored either in memory or to a persistent data store:

The stateful failover architecture includes:

The server takes care of converting the specified state data type to and from a form suitable for persistent storage or in-memory replication. This feature is very powerful because any IDL datatype (or serializable Java class) can be used as the state type. In many cases, the most suitable state type is an IDL struct type, which can be created in the IDL editor (required when using C++ or COM components), or generated automatically from a Java class or PowerBuilder structure type by the PowerJ or PowerBuilder deployment process.

Supported component implementations

To use persistent state management, a stateful component must be an EJB stateful session bean or a component of another type that uses the control interface CtsComponents::ObjectControl. (See "Configuring a control interface".)

You can manage persistence using these techniques:

Using EJB activation and passivation

This stateful persistence model is how EAServer implements the standard EJB passivation and activation protocol. This model can be used only by EJB stateful session beans.

Configure the following fields on the Persistence Tab in the Component Properties window:

Using automatic persistence

To use automatic persistence, you must define a state datatype to hold your component's instance state, implement accessor methods, and choose a storage component. Configure these properties fields on the Persistence Tab in the Component Properties window:

 


Copyright © 2002 Sybase, Inc. All rights reserved.