I know this question is weird but just wondering: is there any way to create multiple instances of a Singleton class in Java?
My situation is like this:
I have an Singleton class and i need to have 2 objects/instances of that class. Is there any way to modify class to be able to create multiple instances?
My class:
public class SingletonClass {
    private static SingletonClass sSoleInstance;
    //private constructor.
    private SingletonClass(){
        //Prevent form the reflection api.
        if (sSoleInstance != null){
            throw new RuntimeException("Use getInstance() method to get the single instance of this class.");
        }
    } 
    public static SingletonClass getInstance(){
        if (sSoleInstance == null){ //if there is no instance available... create new one
            sSoleInstance = new SingletonClass();
        }
        return sSoleInstance;
    }
}
 
     
    