public void initDatabaseInstance ( ) { if ( database == null ) { for ( int retry = 0 ; retry < 100 ; ++ retry ) { try { database = distributed . getDatabaseInstance ( ) ; // OK break ; } catch ( OStorageException e ) { // WAIT FOR A WHILE, THEN RETRY if ( ! dbNotAvailable ( retry ) ) return ; } catch ( OConfigurationException e ) { // WAIT FOR A WHILE, THEN RETRY if ( ! dbNotAvailable ( retry ) ) return ; } } if ( database == null ) { ODistributedServerLog . info ( this , manager . getLocalNodeName ( ) , null , DIRECTION . NONE , "Database '%s' not present, shutting down database manager" , databaseName ) ; distributed . shutdown ( ) ; throw new ODistributedException ( "Cannot open database '" + databaseName + "'" ) ; } } else if ( database . isClosed ( ) ) { // DATABASE CLOSED, REOPEN IT database . activateOnCurrentThread ( ) ; database . close ( ) ; database = distributed . getDatabaseInstance ( ) ; } }
Opens the database .