mardi 9 octobre 2018

Will this singleton class cause issue in multithreading

Will the following singleton class code cause any problems in multithreading environment?

public class mySingletonClass{  

    private static mySingletonClass INSTANCE = new mySingletonClass();      

    private mySingletonClass() 
    {       
        super();    
    }   

    public static mySingletonClass getInstance() 
    {       
        return INSTANCE;    
    }
}

Aucun commentaire:

Enregistrer un commentaire