private void init ( boolean upgrade ) { initAdapter ( ) ; initQueries ( ) ; if ( upgrade ) { dbUpgrade ( ) ; } // First contact with the DB is version checking (if no connection opened by pool). // If DB is in wrong version or not available, just wait for it to be ready. boolean versionValid = false ; while ( ! versionValid ) { try { checkSchemaVersion ( ) ; versionValid = true ; } catch ( Exception e ) { String msg = e . getLocalizedMessage ( ) ; if ( e . getCause ( ) != null ) { msg += " - " + e . getCause ( ) . getLocalizedMessage ( ) ; } jqmlogger . error ( "Database not ready: " + msg + ". Waiting for database..." ) ; try { Thread . sleep ( 10000 ) ; } catch ( Exception e2 ) { } } } }
Main database initialization . To be called only when _ds is a valid DataSource .