Garantir une instance unique.
<strong>public static</strong> MySingletonClass <strong>getInstance</strong>() {<br> if (mySingleton == null) {<br> <strong>synchronized</strong> (MySingletonClass.class) {<br> mySingleton = new MySingletonClass();<br> }<br> }<br> return mySingleton;<br> }