Java Singleton

public class ConnEnv {

/** The instance. */

private static ConnEnv instance;

private ConnEnv(){

}

public static ConnEnv getInstance(){

if (instance == null) {

createInstance();

}

return instance;

}

/**

  • Creates the instance.

*/

private static synchronized void createInstance() {

if (instance==null) {

try {

instance = new ConnEnv();

} catch (Exception e) {

// throw e;

}

}

}

}