9.4. 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>. For 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.