Share via


xSession.currentRetryCount Method

Definition

Counts the number of times a try block has been retried after a deadlock, an update conflict, or another exception.

public:
 static int currentRetryCount();
public static int currentRetryCount ();
static member currentRetryCount : unit -> int
Public Shared Function currentRetryCount () As Integer

Returns

The number of times that the try block has been retried.

Remarks

The following example uses the currentRetryCount method to test how many times that a transaction has been retried to determine the exception handling for a CUD transaction.

catch (Exception::UpdateConflict) 
    { 
        if (appl.ttsLevel() == 0) 
        { 
            if (xSession::currentRetryCount() >= #RetryNum) 
            { 
                throw Exception::UpdateConflictNotRecovered; 
            } 
            else 
            { 
                retry; 
            } 
        } 
        else 
        { 
            throw Exception::UpdateConflict; 
        } 
    }

Applies to