JOnAS Specificity

Target Audience, Goals, and Content

The target audience for this guide is the Application provider, i.e. the person in charge of developing the software components on the server side. This section discusses the various JOnAS-specific elements in the development cycle of the Application, Enterprise Bean, and web component that are not defined in the J2EE, EJB, or Servlet/JSP specification.

The content of this guide is the following:

  1. Target Audience, Goals, and Content
  2. Configuration of DataSource Objects
  3. JOnAS-Specific Deployment Descriptor
  4. isModified Optimization for Container-managed Entity Beans
  5. Passivation Timeout for Entity Beans
  6. Getting a UserTransaction object from a non-EJB client
  7. Container Optimizations for Entity Beans

Configuration of DataSource Objects

Definition and configuration of the DataSource objects available on the application server are specific to JOnAS. Refer to the section "Configuring JDBC DataSources."

JOnAS-Specific Deployment Descriptor

A JOnAS-specific deployment descriptor contains information assigned by the deployer.

isModified Optimization for Container-managed Entity Beans

To improve performance, JOnAS implements the isModified extension. Before performing an update, the container calls a method of the bean whose name is identified in the is-modified-method-name element of the JOnAS-specific deployment descriptor. This method is responsible for determining if the state of the bean has been changed. By doing this, the container determines if it must store data in the database or not.

Example

The bean implementation manages a boolean isDirty and implements a method that returns the value of this boolean: isModified

    
    private transient boolean isDirty;
    public boolean isModified() {
        return isDirty;
    }
    

The JOnAS-specific deployment descriptor directs the bean to implement an isModified method:

 
    <jonas-entity>
      <ejb-name>Item</ejb-name>
      <is-modified-method-name>isModified</is-modified-method-name>
      .....
    </jonas-entity>
    

Methods that modify the value of the bean must set the flag isDirty to true.
Methods that restore the value of the bean from the database must reset the flag isDirty to false. Therefore, the flag must be set to false in the ejbLoad() and ejbStore() methods.

Passivation Timeout for Entity Beans

Entity bean instances are passivated at the end of the transaction and reactivated at the beginning of the next transaction. In the event that these instances are accessed outside a transaction, their state is kept in memory to improve performance. However, a passivation will occur in three situations:
  1. When the bean is unloaded from the server, at a minimum when the server is stopped.
  2. When a transaction is started on this instance.
  3. After a configurable timeout. If the bean is always accessed with no transaction, it may be prudent to periodically store the bean state on disk.
This passivation timeout can be configured in the JOnAS-specific deployment descriptor, with a non-mandatory tag <passivation-timeout>. Example:
    <jonas-entity>
      <ejb-name>Item</ejb-name>
      <passivation-timeout>5</passivation-timeout>
      .....
    </jonas-entity>
    
This entity bean will be passivated every five second, if not accessed within transactions.

Getting a UserTransaction object from a non-EJB client

This information is specified in the Starting Transactions from the Client Side Howto Guide.

Container Optimizations for Entity Beans

These types of optimizations are described in the Developing Entity Beans chapter of the Programmer's Guide (section "Tuning Container for Entity Bean Optimization").