CL_ABAP_WEAK_REFERENCE - Weak References

ROGBILLS - Synchronize billing plans   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Functionality

An object in the class CL_ABAP_WEAK_REFERENCE represents a weak reference to an object. Unlikenormal object references, a weak reference sustains the referenced objects only under certain conditions.If the Garbage Collector is running and the referenced object is accessible using weak references only, then the object is released.

Weak references can be used to implement a cache only under limitations. This is because the lifetime of the objects is relatively short, even when a lot of free memory is available.

Weak references can be used for monitoring purposes: If the referenced object is still alive, it can be accessed without its lifetime being extended.

Relationships

Example

A weak reference is created for an object o1 as follows:

DATA r1 TYPE REF TO cl_abap_weak_reference.
CREATE OBJECT r1 EXPORTING oref = o1.

Later, an attempt can be made to access the object again:

o1 ?= r1->get( ).
IF o1 IS NOT INITIAL.
  " The object is still alive.
ELSE.
  " The object has already been released.
ENDIF.

Notes

Further information



BAL Application Log Documentation   CPI1466 during Backup  
This documentation is copyright by SAP AG.


Length: 1304 Date: 20120526 Time: 083519     triton ( 52 ms )