allSharedTransientInstances

allSharedTransientInstances(objArray:          ObjectArray;
                            maxInsts:          Integer;
                            includeSubclasses: Boolean);

The allSharedTransientInstances method of the Class class adds all transient instances of the receiver class (and optionally the subclasses of the receiver class) that were created with the sharedTransient qualifier (that is, transient objects that can be shared between processes) to the array specified in the objArray parameter.

The object array is not cleared before instances are added.

The maxInsts parameter specifies the maximum number of instances. A maxInsts parameter value of zero (0) indicates that there is no maximum number of instances.

All transient instances of the subclasses of the receiver class are included in the array when the includeSubclasses parameter is set to true.

The code fragment in the following example shows the use of this method.

create coll transient;
foreach class in classColl do
    class.allSharedTransientInstances(coll, 0, true);
    foreach object in coll do
        if not (object = self or object = caller) then
            count := count + 1;
            found := true;
            if count = 1 then
                write 'Class - ' & class.name;
            endif;
            write '  Transient - ' & object.String;
        endif;
    endforeach;
    coll.clear;
    count := 0;
endforeach;

See also "Caveat When Handling Shared Transient Class Instances", earlier in this section.