3.4.7.2 Begin Phase One

The Begin Phase One event MUST be signaled with the following arguments:

  • An XA Subordinate Enlistment object.

  • Single Phase flag.

If the Begin Phase One event is signaled, the XA Resource Manager Bridge Facet MUST perform the following actions:

  • If the State field of the provided XA Subordinate Enlistment object is set to Enlisted:

    • If the provided Single Phase flag is set to FALSE:

      • Call xa_prepare on the XA Switch of the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object with the following arguments:

        • The XID field of the provided XA Subordinate Enlistment object.

        • The XA Resource Manager Identifier field of the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object.

        • TMNOFLAGS.

      • If the Output is set to XA_OK:

        • Set the State field of the XA Subordinate Enlistment object to Prepared.

        • Signal the Enlistment Phase One Complete event on the Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Prepared.

      • If the Output is set to XA_RDONLY:

        • Signal the Enlistment Phase One event on Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Read Only.

        • Set the State field of the XA Subordinate Enlistment object to Ended.

        • Remove the provided XA Subordinate Enlistment object from the XA Subordinate Enlistment Table referenced by the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object.

      • If the Output is set to XAER_RMFAIL or XAER_RMERR:

        • Signal the Enlistment Phase One Complete event on the Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Aborted.

        • Set the State of the provided XA Subordinate Enlistment object to Ended.

        • Remove the provided XA Subordinate Enlistment object from the XA Subordinate Enlistment Table referenced by the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object.

        • Signal the Recover XA Resource Manager event on the XA Resource Manager Bridge Facet with the following argument:

          • The XA Resource Manager object referenced by the provided XA Subordinate Enlistment object.

      • Otherwise:

        • Signal the Enlistment Phase One Complete event on the Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Aborted.

        • Set the State field of the provided XA Subordinate Enlistment object to Ended.

        • Remove the provided XA Subordinate Enlistment object from the XA Subordinate Enlistment Table referenced by XA Resource Manager object referenced by the provided XA Subordinate Enlistment.

    • Otherwise:

      • Call xa_commit on the XA Switch of the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object with the following arguments:

        • The XID field of the provided XA Subordinate Enlistment object.

        • The XA Resource Manager Identifier field of the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object.

        • TMONEPHASE.

      • If the Output is set to XA_OK:

        • Signal the Enlistment Phase One Complete event on the Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Committed.

        • Set the State field of the XA Subordinate Enlistment object to Ended.

        • Remove the provided XA Subordinate Enlistment object from the XA Subordinate Enlistment Table referenced by XA Resource Manager object referenced by provided XA Subordinate Enlistment object.

      • If the Output is set to XAER_RMFAIL:

        • Signal Enlistment Phase One Complete event on the Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Aborted.

        • Set the State field of the XA Subordinate Enlistment object to Ended.

        • Remove the provided XA Subordinate Enlistment object from the XA Subordinate Enlistment Table referenced by XA Resource Manager object referenced by provided XA Subordinate Enlistment.

        • Signal the Recover XA Resource Manager event on XA Resource Manager Bridge Facet with the following argument:

          • The XA Resource Manager object referenced by the provided XA Subordinate Enlistment object.

      • Otherwise:

        • Signal Enlistment Phase One Complete event on the Core Transaction Manager Facet with the following arguments:

          • The provided XA Subordinate Enlistment object.

          • The Outcome set to Aborted.

        • Set the State field of the provided XA Subordinate Enlistment object to Ended.

        • Remove the provided XA Subordinate Enlistment object from the XA Subordinate Enlistment Table referenced by the XA Resource Manager referenced by the provided XA Subordinate Enlistment object.

    • If the XA Subordinate Enlistment Table of the XA Resource Manager object referenced by the provided XA Subordinate Enlistment object is empty and the State field of XA Resource Manager referenced by the provided XA Subordinate Enlistment object is set to Ended:

      • Remove the XA Resource Manager referenced by the provided XA Subordinate Enlistment object from the XA Resource Manager Durable Log.

      • Remove the XA Resource Manager referenced by the provided XA Subordinate Enlistment object from the XA Resource Manager Table.