void close ( Supplier < CentralDogmaException > failureCauseSupplier ) { requireNonNull ( failureCauseSupplier , "failureCauseSupplier" ) ; if ( closePending . compareAndSet ( null , failureCauseSupplier ) ) { repositoryWorker . execute ( ( ) -> { rwLock . writeLock ( ) . lock ( ) ; try { if ( commitIdDatabase != null ) { try { commitIdDatabase . close ( ) ; } catch ( Exception e ) { logger . warn ( "Failed to close a commitId database:" , e ) ; } } if ( jGitRepository != null ) { try { jGitRepository . close ( ) ; } catch ( Exception e ) { logger . warn ( "Failed to close a Git repository: {}" , jGitRepository . getDirectory ( ) , e ) ; } } } finally { rwLock . writeLock ( ) . unlock ( ) ; commitWatchers . close ( failureCauseSupplier ) ; closeFuture . complete ( null ) ; } } ) ; } closeFuture . join ( ) ; }
Waits until all pending operations are complete and closes this repository .