public void checkIndex ( final InspectionReport report , final boolean isSystem ) throws RepositoryException , IOException { if ( isSuspended . get ( ) ) { try { SecurityHelper . doPrivilegedExceptionAction ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws RepositoryException , IOException { // try resuming the workspace try { if ( isSystem && parentSearchManager != null && parentSearchManager . isSuspended . get ( ) ) { parentSearchManager . resume ( ) ; } resume ( ) ; handler . checkIndex ( itemMgr , isSystem , report ) ; return null ; } catch ( ResumeException e ) { throw new RepositoryException ( "Can not resume SearchManager for inspection purposes." , e ) ; } finally { // safely return the state of the workspace try { suspend ( ) ; if ( isSystem && parentSearchManager != null && ! parentSearchManager . isSuspended . get ( ) ) { parentSearchManager . suspend ( ) ; } } catch ( SuspendException e ) { LOG . error ( e . getMessage ( ) , e ) ; } } } } ) ; } catch ( PrivilegedActionException e ) { Throwable ex = e . getCause ( ) ; if ( ex instanceof RepositoryException ) { throw ( RepositoryException ) ex ; } else if ( ex instanceof IOException ) { throw ( IOException ) ex ; } else { throw new RepositoryException ( ex . getMessage ( ) , ex ) ; } } } else { // simply run checkIndex, if not suspended handler . checkIndex ( itemMgr , isSystem , report ) ; } }
Check index consistency . Iterator goes through index documents and check does each document have according jcr - node . If index is suspended then it will be temporary resumed while check is running and suspended afterwards .