RollbackOnly

Description

Modifies an EAServer transaction associated with a calling thread so that the only possible outcome is to roll back the transaction.

Applies to

CORBACurrent objects

Syntax

CORBACurrent.RollbackOnly (  )

Argument

Description

CORBACurrent

Reference to the CORBACurrent service instance

Returns

Integer. Returns 0 if it succeeds and one of the following negative values if an error occurs:

Usage

RollbackTransaction is typically called by the originator of the transaction. Another participant in a client- or OTS style transaction can call RollbackOnly to vote that the transaction should be rolled back.

RollbackOnly can be called by a client or a component that is marked as OTS style. EAServer must be using the two-phase commit transaction coordinator (OTS/XA).

Examples

Example 1

In this example, a participant in a transaction has determined that it should be rolled back. It creates and initializes an instance of the CORBACurrent service object and votes to roll back the transaction:

// Instance variable:
// CORBACurrent corbcurr
int li_rc

li_rc = this.GetContextService("CORBACurrent", &
    corbcurr)
IF li_rc <> 1 THEN
// handle the error
END IF

li_rc = corbcurr.Init()

IF li_rc <> 0 THEN
// handle the error
ELSE
    corbcurr.RollbackOnly()
END IF

See also