getQueuedLocks

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

The getQueuedLocks method of the Node class populates the array specified in the locks parameter with transient instances of the lock requests that are waiting for shared transient objects in the node specified as the method receiver to be unlocked by the processes that currently have them locked.

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

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

The calling process is responsible for creating and deleting the LockArray instance used with this method, as well as deleting the Lock instances inserted into the array.

The following example shows the use of the getQueuedLocks method.

showQueuedSharedTransientLocks();
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 'Queued shared transient locks for node ' & n.String;
        n.getQueuedLocks(lockArray, 100);
        foreach lock in lockArray do
            write 'Oid ' & lock.target.String;
            write 'Locked by ' & lock.lockedBy.String;
            write 'Requested by ' & lock.requestedBy.String;
        endforeach;
        lockArray.purge;
    endforeach;
epilog
    delete nodedict;
    delete lockArray;
end;

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

Queued shared transient locks for node Node/186.1
Queued shared transient locks for node Node/186.2
Oid Animal/51248.1
Locked by Process/187.5
Requested by Process/187.6