getLocks

getLocks(locks:      LockArray input;
         maxEntries: Integer);

The getLocks method of the Node class populates the array specified in the locks parameter with transient instances of the current locks for the shared transient objects in the node specified as the method receiver.

The parameters for the getLocks method are listed in the following table.

Parameter Specifies the …
locks Locks array that is to be populated with the lock instances
maxEntries Maximum number of lock instances that are to be included in the array

The following example shows the use of the getLocks method.

showSharedTransientLocks();
vars
    lock : Lock;
    lockArray : LockArray;
    nodedict : NodeDict;
    n : Node;
begin
    create lockArray transient;
    create nodedict transient;
    system.nodes.copy(nodedict);
    foreach n in nodedict do
        write "Shared transient locks for node " & n.String;
        n.getLocks(lockArray, 100);
        foreach lock in lockArray do
            write 'Oid ' & lock.target.String;
            write 'Locked by ' & lock.requestedBy.String;
        endforeach;
        lockArray.purge;
    endforeach;
epilog
    delete nodedict;
    delete lockArray;
end;

The output from the getLocks method shown in the previous example is as follows.

Shared transient locks for node Node/186.1
Shared transient locks for node Node/186.2
Oid Animal/51248.1
Locked by Process/187.04