void attemptRestoreRemovedStorage ( ) { // if directory is "alive" - copy the images there... if ( removedStorageDirs . size ( ) == 0 ) return ; //nothing to restore /* We don't want more than one thread trying to restore at a time */ synchronized ( this . restorationLock ) { LOG . info ( "attemptRestoreRemovedStorage: check removed(failed) " + "storage. removedStorages size = " + removedStorageDirs . size ( ) ) ; for ( Iterator < StorageDirectory > it = this . removedStorageDirs . iterator ( ) ; it . hasNext ( ) ; ) { StorageDirectory sd = it . next ( ) ; File root = sd . getRoot ( ) ; LOG . info ( "attemptRestoreRemovedStorage: currently disabled dir " + root . getAbsolutePath ( ) + "; type=" + sd . getStorageDirType ( ) + ";canwrite=" + root . canWrite ( ) ) ; try { if ( root . exists ( ) && root . canWrite ( ) ) { LOG . info ( "attemptRestoreRemovedStorage: restoring dir " + sd . getRoot ( ) . getAbsolutePath ( ) ) ; this . addStorageDir ( sd ) ; // restore it . remove ( ) ; sd . lock ( ) ; } } catch ( IOException e ) { LOG . warn ( "attemptRestoreRemovedStorage: failed to restore " + sd . getRoot ( ) . getAbsolutePath ( ) , e ) ; } } } }
See if any of removed storages is writable again and can be returned into service .