Skip Headers

Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Managing the Bean Instance Pool

OC4J provides EJB pooling attributes that you can configure to improve performance by reducing the frequency of bean instance creation.

This section describes:

- Configuring Bean Instance Pool Size

- Configuring Bean Instance Pool Timeouts for Session Beans

- Configuring Bean Instance Pool Timeouts for Entity Beans

## Configuring Bean Instance Pool Size

You can set the minimum and maximum number of the bean instance pool for session beans, entities, and message-driven beans.

You can configure the bean pool size:

- Using Oracle Enterprise Manager 10g Application Server Control

- Using Deployment XML

### Using Deployment XML

In the `orion-ejb-jar.xml` file you set the bean pool size with the following attributes of the `<entity-deployment>` element, for entities, and the `<session-deployment>` element, for session beans:

- The `max-instances` attribute sets the maximum number of bean instances allowed in the pool. The default is 0, which means infinite.

  For example, if you wanted to set the maximum entity implementation instances to 20, you would do as follows:

      <entity-deployment ...  max-instances="20"
        ...
      </entity-deployment>

- The `min-instances` attribute sets the minimum number of bean instances allowed in the pool.

  For example, if you wanted to set the minimum entity implementation instances to 2, you would do as follows:

      <entity-deployment ... min-instances="2"
        ...
      </entity-deployment>

If you change this property using this method, you must restart OC4J to apply your changes. Alternatively, you can use Application Server Control Console to modify this parameter dynamically without restarting OC4J (see "Using Oracle Enterprise Manager 10g Application Server Control").

## Configuring Bean Instance Pool Timeouts for Session Beans

You can set the maximum amount of time that session beans are cached in the bean instance pool.

You can configure pool timeouts for session beans:

- Using Oracle Enterprise Manager 10g Application Server Control

- Using Deployment XML

### Using Deployment XML

In the `orion-ejb-jar.xml` file you set the bean pool timeout with the following attributes of the `<session-deployment>` element for session beans:

- The `pool-cache-timeout` attribute is applicable to stateless session beans and sets how long to keep stateless sessions cached in the pool. The default is 0 seconds, which means never timeout.

  For example, if you wanted to set the `pool-cache-timeout` to 90 seconds, you would do as follows:

      <session-deployment ...  pool-cache-timeout="90"
        ...
      </session-deployment>

- The `timeout` attribute is applicable to stateful session beans and sets how long a stateful session bean can remain inactive before it is removed from the bean instance pool. The default is 1800 seconds.

  For example, if you wanted to set the stateful session bean inactivity timeout to 900 seconds, you would do as follows:

      <sessi0n-deployment ...  timeout="900"
        ...
      </session-deployment>

If you change this property using this method, you must restart OC4J to apply your changes. Alternatively, you can use Application Server Control Console to modify this parameter dynamically without restarting OC4J (see "Using Oracle Enterprise Manager 10g Application Server Control").

## Configuring Bean Instance Pool Timeouts for Entity Beans

You can set the maximum amount of time that entities are cached in the bean instance pool.

You can configure pool timeouts for entities:

- Using Oracle Enterprise Manager 10g Application Server Control

- Using Deployment XML

### Using Deployment XML

In the `orion-ejb-jar.xml` file you set the bean pool timeout with the following attributes of the `<entity-deployment>` element for entities:

- The `pool-cache-timeout` attribute sets how long entity bean implementation instances are to be kept in the "pooled" (unassigned) state. The default is 60 seconds. Setting this attribute to "never" means never timeout.

  For example, if you wanted to set the pool-cache-timeout for entities to 90 seconds, you would do as follows:

      <entity-deployment ...  pool-cache-timeout="90"
        ...
      </entity-deployment>

If you change this property using this method, you must restart OC4J to apply your changes. Alternatively, you can use Application Server Control Console to modify this parameter dynamically without restarting OC4J (see "Using Oracle Enterprise Manager 10g Application Server Control").