I have a class that will act as singleton.
This class will get a file as part of the constructor. After that the class is ready to go.
So currently I use the double-check-locking idiom and get an instance of the singleton via a static getInstance() i.e. the classic way.
My problem is that currently I do constantly:
MySingleton.getInstance(theFile);
And theFile is only needed in the first time the singleton is constructed. After that, i.e. once the singleton has been constructed I don't need to pass in the theFile.
How would I do that?
I thought to create a MySingleton.getInstance(); but still this would not work since the caller must call the MySingleton.getInstance(theFile); the first time to construct a valid class.
How can I design this better?