lockTarget

lockTarget(): Object;

The lockTarget method of the LockException class returns a reference to the object that is the target of the lock on which an exception is raised.

The following example shows the use of the lockTarget method.

handleLockException(le: LockException): Integer;
vars
    result  : Integer;
    message : String;
begin
    message := "Cannot get lock for " & le.lockTarget.String &
               ". It is locked by user " ;
    result  := app.msgBox(message & le.targetLockedBy.userCode & ". Retry?",
               "Lock Error", MsgBox_Question_Mark_Icon + MsgBox_Yes_No);
    if result = MsgBox_Return_Yes then
        app.mousePointer := Busy;
        while not tryLock(le.lockTarget, le.lockType, le.lockDuration,
                          LockTimeout_Server_Defined) do
            app.mousePointer := Idle;
            result := app.msgBox(message & le.targetLockedBy.userCode &
                      ". Retry?", "Lock Error", MsgBox_Question_Mark_Icon +
                      MsgBox_Yes_No);
            if result = MsgBox_Return_No then
                return Ex_Abort_Action;
            endif;
            app.mousePointer := Busy;
        endwhile;
        return Ex_Resume_Next;
    else
        return Ex_Abort_Action;
    endif;
epilog
    app.mousePointer := Idle;
end;