‎2011 Oct 06 2:43 PM
HI all
There is a way to kill instance of static method? (not my class and i cant change it )
in the class there is method get instance and I want that in RT process (during one session call ) to get new instance.
I would like to do that during RT process ,like destruct in other language .
I know that this is now simple but maybe there is a way in abap ....
Thanks,
Joy
Edited by: Joy Stpr on Oct 6, 2011 5:43 PM
‎2011 Oct 07 6:19 AM
Garbage collector will delete object which once there is no reference pointing to it (so simply ensure you remove all references). This is the only way to destruct the object in ABAP.
Regards
Marcin
‎2011 Oct 07 6:19 AM
Garbage collector will delete object which once there is no reference pointing to it (so simply ensure you remove all references). This is the only way to destruct the object in ABAP.
Regards
Marcin
‎2011 Oct 10 10:43 AM
Hello Marcin,
If i understand correctly the OP is facing this problem because "singleton" pattern is implemented in the class!
Also afaik developer cannot trigger the Garbage Collector. So i was thinking if we can use the [C-destructor |http://help.sap.com/abapdocu_702/en/abenc_destructor.htm]call to destroy the static instance attribute of this class?
Let me know your thoughts.
BR,
Suhas
‎2011 Oct 10 2:04 PM
Hi Suhas,
Documentation of C-destuctor (nice to know that there is something like that) says it should only be used in special cases and for internal use only. I think the easies would be simply "unbinding" this static attribute which would cause Garbage Collector to pick refering object (itself) and delete it. I didn't say GC needs to be called directly
Regards
Marcin
‎2011 Oct 11 3:25 AM
Hey Marcin,
I didn't say GC needs to be called directly
I bet you didn't
I'm yet to understand GC's clandestine operations ... He he
Cheers,
Suhas