3.3.4.5 Xa_end

The Xa_end event MUST be signaled with the following arguments:

  • XID - XA Transaction Branch Identifier.

  • RMID - Resource Manager ID.

  • Flags - Flags defined [XOPEN-DTP] Chapter 4.4.

The Xa_end event MUST return the following value:

  • XA Result - Return code defined in [XOPEN-DTP] Chapter 4.5.

If the Xa_end event is signaled, the XA Superior Transaction Manager MUST perform the following actions:

  • If provided Flags has TMASYNC set:

    • Return XAER_ASYNC.

  • If provided Flags has TMMIGRATE set:<16>

    • SHOULD check if TMSUSPEND flag is not set:

      • Return XAER_PROTO.

  • Attempt to find an XA Superior Proxy object in the XA Superior Proxy Table corresponding to the provided RMID.

  • If not found:

    • Return XAER_RMFAIL.

  • Otherwise:

    • Attempt to find an XA Transaction object corresponding to the provided XID in the XA Transaction Table referenced by XA Superior Proxy object.

    • If found:

      • If Flags has TMSUSPEND set:

        • If the State field of the located XA Transaction Object is set to Active:

          • Set the State field of the located XA Transaction to Suspended.

          • If Flags has TMMIGRATE set:

            • Attempt to create XA Transaction CMP Connection with the following settings:

              • Connection type SHOULD<17> be set to CONNTYPE_XAUSER_XACT_MIGRATE2 (section 2.2.4.8).

              • XA Transaction Object set to the located XA Transaction object.

              • State set to Awaiting Suspension Response.

              • XA Transaction object, State set to Suspended.

              • Action set to Migrate.

            • If Successful:

              • Send an XAUSER_XACT_MTAG_SUSPEND_WITH_MIGRATE message with the following values:

                • guidXaRm is set to the Resource Manager Recovery GUID field of the located XA Superior Proxy object.

                • lenXAIdentifier is set to the size of an XA_XID structure (section 2.2.1.3).

                • XAIdentifier is set to the provided XID.

                • dwProcessId is set to the Current Process Identifier.

                • dwThreadId set to the Current Thread Identifier.

                • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_MIGRATE2 Initiator (section 3.3.5.7).

            • Otherwise:

              • Return XA_RMFAIL.

          • Otherwise:

            • Return XA_OK.

        • Otherwise:

          • Return XAER_RMERR.

      • Otherwise:

        • Verify that the Thread Identifier field of the XA Transaction Object is set to the Current Thread Identifier.

        • If Fail:

          • Return XAER_PROTO.

        • Otherwise:

          • Signal the Disconnect Connection event using the connection referenced by the XA Transaction Object as the argument.

          • Remove the XA Transaction Object from the XA Transaction Table of the located XA Superior Proxy.

          • Return XA_OK.

    • Otherwise:

      • Return XAER_NOTA.