Voilà je cherche a implémenter un singleton pour une application j'ai donc regarder ces tutoriaux:

1. http://christophej.developpez.com/tu...n/multithread/
2. http://smeric.developpez.com/java/uml/singleton/

j'ai donc ma class Singleton
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
public class Singleton {
  private static Singleton instance;
  private Singleton(String[] myChaine) throws IOException {
         vlcManager vlc = null;
 
        if(myChaine[0].matches("start")){
            try{
                init fileinit = new init();
                runner redWire = new runner();
                creatPlaylist play = new creatPlaylist();
            }
            catch(IOException e){
                System.out.print("Le disque dur n'est pas accessible.");
            }
           vlc = new vlcManager("start");
        }
        else if(myChaine[0].matches("stop")){
 
            try{
                vlc = new vlcManager("stop");
            }
            catch(Exception e){
            }
       }
  }
 
  public static Singleton getInstance(String[] chaine) throws IOException {
    if (null == instance) {
      instance = new Singleton(chaine);
    }
    return instance;
  }
}
et mon main

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
 public class Main {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
       Singleton singleApp = Singleton.getInstance(args);
    }
 
}
je lance donc mon appli argument start > tout demarre bien
je lance l'appli argument start de nouveau et là, en mode pas à pas mon instance de singleton est "null" alors que celle ci est instancié d'où mon incompréhension.

Que fais je mal?

merci de votre aide