protected void loadLocalDatabases ( ) { final List < String > dbs = new ArrayList < String > ( serverInstance . getAvailableStorageNames ( ) . keySet ( ) ) ; Collections . sort ( dbs ) ; for ( final String databaseName : dbs ) { if ( messageService . getDatabase ( databaseName ) == null ) { ODistributedServerLog . info ( this , nodeName , null , DIRECTION . NONE , "Opening database '%s'..." , databaseName ) ; // INIT THE STORAGE final ODistributedStorage stg = getStorage ( databaseName ) ; executeInDistributedDatabaseLock ( databaseName , 60000 , null , new OCallable < Object , OModifiableDistributedConfiguration > ( ) { @ Override public Object call ( OModifiableDistributedConfiguration cfg ) { ODistributedServerLog . info ( this , nodeName , null , DIRECTION . NONE , "Current node started as %s for database '%s'" , cfg . getServerRole ( nodeName ) , databaseName ) ; final ODistributedDatabaseImpl ddb = messageService . registerDatabase ( databaseName , cfg ) ; ddb . resume ( ) ; // 1ST NODE TO HAVE THE DATABASE cfg . addNewNodeInServerList ( nodeName ) ; // COLLECT ALL THE CLUSTERS WITH REMOVED NODE AS OWNER reassignClustersOwnership ( nodeName , databaseName , cfg , true ) ; try { ddb . getSyncConfiguration ( ) . setLastLSN ( nodeName , ( ( OAbstractPaginatedStorage ) stg . getUnderlying ( ) ) . getLSN ( ) , false ) ; } catch ( IOException e ) { ODistributedServerLog . error ( this , nodeName , null , DIRECTION . NONE , "Error on saving distributed LSN for database '%s' (err=%s)." , databaseName , e . getMessage ( ) ) ; } ddb . setOnline ( ) ; return null ; } } ) ; } } }
Initializes all the available server s databases as distributed .