Forum Discussion
mlenosgrande
16 years agoContributor
Hi
You want to have a singleton in pattern word.
One way is to put your script in a jar in the directory ext
Your class should be something like this in a multi-threading environment :
You want to have a singleton in pattern word.
One way is to put your script in a jar in the directory ext
Your class should be something like this in a multi-threading environment :
public class Singleton {
private Singleton() {
}
public static Singleton getInstance() {
if (null == instance) {
synchronized(objetSynchrone__) {
if (null == instance) {
instance = new Singleton();
}
}
}
return instance;
}
private static Singleton instance;
private static Object objetSynchrone__;
}