public class Singleton2 {
   public static Singleton2 singleton = null;
   private Singleton2() {}
   public static Singleton2 getInstance() throws SingleException {
     if(singleton == null) {
       singleton = new Singleton2();
     } else {
        throw new SingleException("no more than one instance can be created");
     }
     return singleton;
   }
}
