Resource Health Monitoring Java EE Connector Architecture Resource Adapter
11-8 Programming JTA for Oracle WebLogic Server
The WebLogic Server transaction manager then continues to retry commit of the XAResources for these transactions. As discussed in
Section 11.2, Registering an XAResource to Participate in Transactions
, one purpose of the WebLogic Server transaction manager resource registration API is for bootstrapping XAResource
instances for recovery. You must ensure that an XAResource instance is registered with the WebLogic Server transaction manager upon server restart. The WebLogic
Server transaction manager retries the commit call every minute, until a valid XAResource instance is registered with the WebLogic Server transaction manager.
When a transaction manager that is acting as a transaction coordinator crashes, it is possible that the coordinator may not have logged some in-doubt transactions in the
coordinators transaction log. Thus, upon server restart, the coordinator must call XAResource.recover
on the resource managers, and roll back the in-doubt transactions that were not logged. As with commit retries, the WebLogic Server
transaction manager retries XAResource.recover every 5 minutes, until a valid XAResource instance is registered with the WebLogic Server transaction manager.
The WebLogic Server transaction manager checkpoints a new XAResource in its transaction log records when the XAResource is first enlisted with the WebLogic
Server transaction manager. Upon server restart, the WebLogic Server transaction manager then calls XAResource.recover on all the resources previously
checkpointed removed from the transaction log records after the transaction completed. A resource is only removed from a checkpoint record if it has not been
accessed for the last PurgeResourceFromCheckpointIntervalSeconds interval default is 24 hours. Therefore, to reduce the resource recovery overhead, you should
ensure that only a small number of resource manager instances are registered with the WebLogic Server transaction manager.
When implementing XAResource.recover, you should use the flags as described in the XOpen XA specification as follows:
■
When the WebLogic Server transaction manager calls XAResource.recover with TMSTARTRSCAN, the resource returns the first batch of in-doubt Xids.
The WebLogic Server transaction manager then calls XAResource.recover with TMNOFLAGS
repeatedly, until the resource returns either null or a zero-length array to signal that there are no more Xids to recover. If the resource has returned
all the Xids in the previous XAResource.recoverTMSTARTRSCAN call, then it can either return null or a zero-length array here, or it may also throw XAER_
PROTO , to indicate that it has finished and forgotten the previous recovery scan. A
common XAResource.recover implementation problem is ignoring the flags or always returning the same set of Xids on XAResource.recoverTMNOFLAGS.
This causes the WebLogic Server transaction manager recovery to loop infinitely, and subsequently fail.
■
The WebLogic Server transaction manager XAResource.recover with TMENDRSCAN
flag to end the recovery scan. The resource may return additional Xids.