Configuring the startup of the transaction service

Database transaction recovery can occur either when the transaction service is first used, or at server startup.

About this task

By default, transaction recovery after a server failure happens when the transaction service is first used rather than at server startup. You can alter this behavior by specifying transaction service attributes that control when recovery happens, and whether the system waits for recovery to finish before allowing transactional work to proceed.

Procedure

To configure transaction service startup, specify the following attributes in the transaction element in the server.xml file:

  • totalTranLifetimeTimeout

    Maximum time allowed for transactions started on this server to complete

  • propogatedOrBMTTranLifetimeTimeout

    Upper limit of the transaction timeout for transactions that run in this server

  • heuristicRetryWait

    The number of times that the application server retries a completion signal, such as commit or rollback

  • acceptHeuristicHazard

    Specifies whether all applications on this server accept the possibility of a heuristic hazard occurring in a two-phase transaction that contains a one-phase resource

  • recoverOnStartup
    This attribute can take the following values:
    • true: Transaction recovery occurs at server startup.
    • false: Transaction recovery occurs when the transaction service is first used.
  • waitForRecovery
    This attribute can take the following values:
    • true: The server waits for transaction recovery to finish before allowing transactional work to proceed.
    • false: The server allows transactional work to proceed without waiting for transaction recovery to finish.

Example

With the following transaction element configuration, transaction recovery occurs at server startup, and the server allows transactional work to proceed.

  <transaction
    totalTranLifetimeTimeout="300s"
    propogatedOrBMTTranLifetimeTimeout="300s"
    heuristicRetryWait="0"
    acceptHeuristicHazard="false" 
    recoverOnStartup="true"
    waitForRecovery="false"
  />