protected void refreshFromSystem ( ) { try { // Re-read and re-register all of the namespaces ... SessionCache systemCache = repository . createSystemSession ( repository . context ( ) , false ) ; SystemContent system = new SystemContent ( systemCache ) ; CachedNode locks = system . locksNode ( ) ; MutableCachedNode mutableLocks = null ; Set < NodeKey > corruptedLocks = new HashSet <> ( ) ; for ( ChildReference ref : locks . getChildReferences ( systemCache ) ) { CachedNode node = systemCache . getNode ( ref ) ; if ( node == null ) { if ( mutableLocks == null ) { mutableLocks = system . mutableLocksNode ( ) ; } NodeKey lockKey = ref . getKey ( ) ; logger . warn ( JcrI18n . lockNotFound , lockKey ) ; mutableLocks . removeChild ( systemCache , lockKey ) ; corruptedLocks . add ( lockKey ) ; continue ; } ModeShapeLock lock = new ModeShapeLock ( node , systemCache ) ; locksByNodeKey . put ( lock . getLockedNodeKey ( ) , lock ) ; } if ( mutableLocks != null ) { system . save ( ) ; for ( Iterator < Map . Entry < NodeKey , ModeShapeLock > > locksIterator = locksByNodeKey . entrySet ( ) . iterator ( ) ; locksIterator . hasNext ( ) ; ) { NodeKey lockKey = locksIterator . next ( ) . getValue ( ) . getLockKey ( ) ; if ( corruptedLocks . contains ( lockKey ) ) { locksIterator . remove ( ) ; } } } } catch ( Throwable e ) { logger . error ( e , JcrI18n . errorRefreshingLocks , repository . name ( ) ) ; } }
Refresh the locks from the stored representation .