Any topic on transactions is incomplete without at least a mention of crash recovery, though implementation is beyond the scope of this article. The Java Connector Architecture allows room for implementation of recovery should your EIS or application server crash:
- If an application server crashes during an active transaction (the transaction is not yet prepared), the EIS aborts the transaction. Similarly, if an EIS crashes with active transactions, the resource adapter aborts them.
- If the application server goes down during an in-doubt transaction (the transaction is prepared but not yet committed), the EIS tries to reestablish communications with the application server and complete the transaction. If the EIS crashes during an in-doubt transaction, the resource adapter waits until the EIS is back online and tries to complete the transaction. The application server invokes the getXAResource(..) method when it's back from a crash, retrieving the XAResources allocated for the respective ActivationSpecs. It then calls recover for each XAResource obtained.