Supported component implementations  Using automatic persistence

Chapter 28: Configuring Persistence for Stateful Session Components

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. In EJB terminology, passivation is the process of removing an instance’s data from memory and saving it to a database. Activation is the process of restoring the state and applying it to an instance of the component. You can configure passivization for single-server and clustered-server deployments as described in Table 28-1.

Table 28-1: EJB stateful session bean passivation options

Option

Description

No passivation

This is the default configuration for EJB stateful session beans. EAServer never performs passivation. If you configure an instance timeout property for the component, instances that time out are destroyed and removed from memory. Subsequent use of the instance handle by a client results in an error.

Serialization with support for load balancing and failover

For clustered (multiserver) deployments. EAServer serializes instance state and saves it to a remote database after every remote interface method invocation. This option can be used to support failover and load balancing in an EAServer cluster and also supports passivation as required by the EJB specification. “Configuring stateful session beans to support failover” describes how to configure this option.

Serialization after timeout

For single-server deployments. EAServer serializes instance data when the instance times out, saving the data to a remote database. This option allows you to support EJB passivation without incurring the overhead of a database write after every method invocation. You can also tune the timeout setting to balance memory use versus response time. “Configuring passivation after timeout” describes how to configure this option.


Configuring stateful session beans to support failover

These settings configure EAServer to save in a remote database a copy of the the session bean’s serialized data after every method invocation. When running in a cluster, the instance data can be restored on any server in which the component is installed, permitting load balancing and failover of the component. Configure the settings in Table 28-2, using the Persistence Tab in the Component Properties dialog box:

Table 28-2: EJB stateful session failover options

Field

Value

Persistence

Automatic Persistent State.

State

The name of the component’s Java class.

Primary Key

None (leave blank).

State Methods

Enter default.

Storage components

The name of the storage component. See “Storage components” for more information.

Connection cache

If you are using database storage, enter the name of a JDBC connection cache that connects to the database. The cache must have by-name access enabled.

Table

If you are using database storage, enter the name of a database table where the serialized data is to be stored. If you use Adaptive Server Enterprise or Adaptive Server Anywhere, EAServer creates the table if it does not exist. When you are using another data server, you or your database administrator (DBA) must create the table manually. The table must have the schema described in “Table schema for binary storage”.


Configuring passivation after timeout

For single-server deployments, these settings configure EAServer to passivate instances when the instance has been idle for the period specified by the Instance Timeout property. EAServer serializes the instance, saves the data in a remote database, and removes the instance from memory. When using this option, you can tune the timeout setting to balance your application’s memory use against the average response time.

The following component properties that must be set in addition to the default EJB stateful session bean component settings:

In EAServer Manager, use the Advanced tab in the Component Properties dialog box to configure these properties. You can also use jagtool or jagant to configure components that use this option, or add an EAServer configuration file to your EJB-JAR file that configures the component properties. See the following references in the EAServer System Administration Guide for more information:





Copyright © 2005. Sybase Inc. All rights reserved. Using automatic persistence