void startEngine() throws ServerStartException {

		// setting up the server
		final boolean isDaemon = true;
		final boolean isSilent = false;

		final HsqlProperties hsqlProp = new HsqlProperties();

		// gives the chance to the descriptors to contribute to the server configuration.
		final AtomicInteger dbCounter = new AtomicInteger(0);
		for (HsqlDatabaseDescriptor db : dbs) {
			
			db.contributeToServerConfiguration(new LocationConfiguration() {

				@Override
				public void setLocation(String dbName, String location) {

					log.info("Registering db #{} : '{}' stored on '{}'", dbCounter, dbName, location);
					int dbIndex = dbCounter.getAndAdd(1);
					if (!(location.startsWith("file:") || location.startsWith("res:") || location
							.startsWith("mem:"))) {
						throw new IllegalArgumentException(location);
					}
					
					hsqlProp.setProperty("server.database." + dbIndex, location);
					hsqlProp.setProperty("server.dbname." + dbIndex, dbName);
				}

			});

		}
		// avoid to open a db remotely
		server = new Server();
		hsqlProp.setProperty("server.remote_open", false);
		try {
			server.setProperties(hsqlProp);
		} catch (IOException | AclFormatException e1) {
			throw new ServerStartException(e1);
		}

		server.setLogWriter(lubricantLoggerWriter.asPrintWriter());
		server.setDaemon(isDaemon);
		server.setSilent(isSilent);
		server.setTrace(false);
		server.setNoSystemExit(true);

		if (definedPort != null) {
			server.setPort(definedPort);
		}
		if (this.address != null) {
			server.setAddress(this.address);
		}

		for (int i = 0; i < this.dbs.size(); i++) {
			log.info("db " + i);
			log.info(server.getDatabaseType(i));
			log.info(server.getDatabaseName(i, true));
			log.info(server.getDatabasePath(i, true));
		}

		// dump config
		log.info("Starting HSQL standalone DBMS...");
		log.info("is daemon: {}", isDaemon);
		log.info("is silent: {}", isSilent);
		log.info("port: {} ", (definedPort != null ? definedPort
				: "HSQL default"));
		log.info("address: {} ", (address != null ? address : "HSQL default"));

		log.info("Waiting for hsql engine to start...");
		
		
		Integer state = server.start();
		Throwable serverError = server.getServerError();
		if(serverError!=null){
			throw new ServerStartException(serverError);
		}			
		do {
			state = server.getState();
			Thread.yield();
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// nothing special
			}			
		}while(state != 1);
		
		log.info("Hsql engine started.");

		try{
			log.info("Starting databases post setup...");
			for (int i = 0; i < dbs.size(); i++) {
				final HsqlDatabaseDescriptor db = dbs.get(i);
				log.info("Post start up for db '{}', {}/{}.", db.getDbName(), i+1, dbs.size());
				db.postStartSetUp();
				db.goReady();
			}
			log.info("Post setup completed.");			
		}catch(Exception e){
			throw new ServerStartException("An error occurred during post setup.", e);
		}

		log.info("Dump connection strings:");
		for (HsqlDatabaseDescriptor db : dbs) {
			log.info("Connection to db {}: {}, account {}/{} ", db.getDbName(),
					db.getUrl(), db.getDbName(), db.getPassword());
		}

		log.info("HSQL standalone DBMS is ready");

	}
void startEngine ( ) throws ServerStartException { final boolean isDaemon = true ; final boolean isSilent = false ; final HsqlProperties hsqlProp = new HsqlProperties ( ) ; final AtomicInteger dbCounter = new AtomicInteger ( 0 ) ; for ( HsqlDatabaseDescriptor db : dbs ) { db . contributeToServerConfiguration ( new LocationConfiguration ( ) { @ Override public void setLocation ( String dbName , String location ) { log . info ( "Registering db #{} : '{}' stored on '{}'" , dbCounter , dbName , location ) ; int dbIndex = dbCounter . getAndAdd ( 1 ) ; if ( ! ( location . startsWith ( "file:" ) || location . startsWith ( "res:" ) || location . startsWith ( "mem:" ) ) ) { throw new IllegalArgumentException ( location ) ; } hsqlProp . setProperty ( "server.database." + dbIndex , location ) ; hsqlProp . setProperty ( "server.dbname." + dbIndex , dbName ) ; } } ) ; } server = new Server ( ) ; hsqlProp . setProperty ( "server.remote_open" , false ) ; try { server . setProperties ( hsqlProp ) ; } catch ( IOException | AclFormatException e1 ) { throw new ServerStartException ( e1 ) ; } server . setLogWriter ( lubricantLoggerWriter . asPrintWriter ( ) ) ; server . setDaemon ( isDaemon ) ; server . setSilent ( isSilent ) ; server . setTrace ( false ) ; server . setNoSystemExit ( true ) ; if ( definedPort != null ) { server . setPort ( definedPort ) ; } if ( this . address != null ) { server . setAddress ( this . address ) ; } for ( int i = 0 ; i < this . dbs . size ( ) ; i ++ ) { log . info ( "db " + i ) ; log . info ( server . getDatabaseType ( i ) ) ; log . info ( server . getDatabaseName ( i , true ) ) ; log . info ( server . getDatabasePath ( i , true ) ) ; } log . info ( "Starting HSQL standalone DBMS..." ) ; log . info ( "is daemon: {}" , isDaemon ) ; log . info ( "is silent: {}" , isSilent ) ; log . info ( "port: {} " , ( definedPort != null ? definedPort : "HSQL default" ) ) ; log . info ( "address: {} " , ( address != null ? address : "HSQL default" ) ) ; log . info ( "Waiting for hsql engine to start..." ) ; Integer state = server . start ( ) ; Throwable serverError = server . getServerError ( ) ; if ( serverError != null ) { throw new ServerStartException ( serverError ) ; } do { state = server . getState ( ) ; Thread . yield ( ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { } } while ( state != 1 ) ; log . info ( "Hsql engine started." ) ; try { log . info ( "Starting databases post setup..." ) ; for ( int i = 0 ; i < dbs . size ( ) ; i ++ ) { final HsqlDatabaseDescriptor db = dbs . get ( i ) ; log . info ( "Post start up for db '{}', {}/{}." , db . getDbName ( ) , i + 1 , dbs . size ( ) ) ; db . postStartSetUp ( ) ; db . goReady ( ) ; } log . info ( "Post setup completed." ) ; } catch ( Exception e ) { throw new ServerStartException ( "An error occurred during post setup." , e ) ; } log . info ( "Dump connection strings:" ) ; for ( HsqlDatabaseDescriptor db : dbs ) { log . info ( "Connection to db {}: {}, account {}/{} " , db . getDbName ( ) , db . getUrl ( ) , db . getDbName ( ) , db . getPassword ( ) ) ; } log . info ( "HSQL standalone DBMS is ready" ) ; }
===============================================================