GetStatus

Description

Returns the status of the EAServer transaction associated with the calling thread.

Applies to

CORBACurrent objects

Syntax

CORBACurrent.GetStatus ( )

Argument

Description

CORBACurrent

Reference to the CORBACurrent service instance

Returns

Integer. Returns -1 if an error occurs and one of the following positive integers if it succeeds:

Usage

The GetStatus function can be used to determine the current status of a transaction by the client or component that initiated the transaction using the BeginTransaction function. EAServer must be using the two-phase commit transaction coordinator (OTS/XA).

GetStatus returns 1 when the transaction has started and no prepares have been issued.

When GetStatus returns 4 or 5, heuristics may exist; otherwise, the transaction would have been completed and destroyed and the value 7 returned.

A return value of 6 indicates that the transaction is in a transient condition and a subsequent call will eventually return another status. I

If GetStatus returns 8, 9, or 10, the transaction has begun but not yet completed the process of preparing, committing, or rolling back, probably because responses from participants in the transaction are pending.

Examples

Example 1

This example shows the use of GetStatus to obtain the state of the current transaction:

// Instance variable:
// CORBACurrent corbcurr
integer li_rc, li_status

li_rc = this.GetContextService("CORBACurrent", &
   corbcurr)
IF li_rc <> 1 THEN
   // handle the error
END IF
li_rc = corbcurr.Init( "iiop://jagserver:2000")
IF li_rc <> 1 THEN
   // handle the error
ELSE
   li_status = corbcurr.GetStatus()
   CHOOSE CASE li_status
      CASE 1
      // take appropriate action for each value
      ...
   END CHOOSE
END IF

See also