/** * Retrieve the lazily initialized instance of the registry. * * @return singleton instance of the registry */ public static EmbeddedRegistry getInstance() { if ( instance == null ) { instance = new EmbeddedRegistry(); Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { try { getInstance().shutdownAll( null ); } catch ( Exception e ) { // ignore, the exception should already have been reported } } } ); } return instance; }
/** * Retrieve the lazily initialized instance of the registry. * * @return singleton instance of the registry */ public static EmbeddedRegistry getInstance() { if ( instance == null ) { instance = new EmbeddedRegistry(); Runtime.getRuntime().addShutdownHook( new Thread() { @Override public void run() { try { getInstance().shutdownAll( null ); } catch ( Exception e ) { // ignore, the exception should already have been reported } } } ); } return instance; }