Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer's Guide

- Previous: Enabling Checkpointing
- Next: Restrictions and Optimizations

### Specifying Methods to Be Checkpointed

If SFSB checkpointing is enabled, checkpointing generally occurs after any transaction involving the SFSB is completed, even if the transaction rolls back.

To specify additional optional checkpointing of SFSBs at the end of non-transactional business methods that cause important modifications to the bean’s state, use the checkpoint-at-end-of-method element within the `ejb` element in `sun-ejb-jar.xml`.

For example:

    <sun-ejb-jar>
       ...
       <enterprise-beans>
          ...
          <ejb availability-enabled="true">
             <ejb-name>ShoppingCartEJB</ejb-name>
             <checkpoint-at-end-of-method>
                <method>
                   <method-name>addToCart</method-name>
                </method>
             </checkpoint-at-end-of-method>
          </ejb>
          ...
       </enterprise-beans>
    </sun-ejb-jar>

The non-transactional methods in the `checkpoint-at-end-of-method` element can be:

- `create()` methods defined in the home interface of the SFSB, if you want to checkpoint the initial state of the SFSB immediately after creation

- For SFSBs using container managed transactions only, methods in the remote interface of the bean marked with the transaction attribute TX_NOT_SUPPORTED or TX_NEVER

- For SFSBs using bean managed transactions only, methods in which a bean managed transaction is neither started nor committed

Any other methods mentioned in this list are ignored. At the end of invocation of each of these methods, the EJB container saves the state of the SFSB to persistent store.

Note –

If an SFSB does not participate in any transaction, and if none of its methods are explicitly specified in the `checkpoint-at-end-of-method` element, the bean’s state is not checkpointed at all even if `availability-enabled="true"` for this bean.

For better performance, specify a small subset of methods. The methods chosen should accomplish a significant amount of work in the context of the J2EE application or should result in some important modification to the bean’s state.

- Previous: Enabling Checkpointing
- Next: Restrictions and Optimizations

- © 2010, Oracle Corporation and/or its affiliates