Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Simultaneous calls to a method in a singleton class

0 Likes
406

I have a singleton class. It has some methods.

- I want to know whether I can call a method of this class simultaneously from two different places.

- I have a local table in this class, I would like to know when this object gets deleted(garbage collected).

Thanks and regards,

Jashua

I have a singleton class. It has some methods.

- I want to know whether I can call a method of this class simultaneously from two different places.

- I have a local table in this class, I would like to know when this object gets deleted(garbage collected).

Thanks and regards,

Jashua

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
364

Hello Jashua

Why should it not be possible to call methods of this class "simultaneously"?

For example, if you have a static method GET_INSTANCE and the singleton instance has not been created yet the first call will create the instance whereas the second call will simply retrieve the already created instance.

If the local table is an instance attribute it will vanish as soon as you do not have any reference to your singleton anymore.

Regards,

Uwe