ABL session object reference attributes
- Last Updated: October 24, 2022
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
The FIRST-OBJECT and LAST-OBJECT attributes
on the SESSION system handle provide access to
the list of currently instantiated objects, commonly referred to
as the SESSION object chain. FIRST-OBJECT and LAST-OBJECT both
hold references to Progress.Lang.Object objects.
Once you get the first object reference in the list using FIRST-OBJECT or the
last object reference in the list using LAST-OBJECT, you
can use the NEXT-SIBLING and PREV-SIBLING properties
on Progress.Lang.Object to walk the list of currently instantiated
objects.
Because these are object references to Progress.Lang.Object,
if you need to use the object as its instantiated type (the type
referenced by the NEW function), you need to CAST the
object to the required type. For more information on casting, see Object reference assignment and casting.
For example, you can display the list of class type names for all classes currently instantiated in the ABL session with the following code:
|
Note that object references on the SESSION object chain
(such as the FIRST-OBJECT attribute and the NEXT-SIBLING object
property) are not included in the reference count for garbage collection.
When the AVM determines that an object's reference count is zero,
it is garbage collected, even though the SESSION object
chain still references it. Once it is garbage collected, the object
is also removed from the SESSION object chain.