I have a context class. So I create an instance of a class. Since this class performs tough and costly mathematical operation I don't want to do it every time. So I am caching the class.
What if as I am creating a new instance what if another thread comes and get the same instance from the cache?
Is there any solution to this problem...?