mirror of
https://github.com/apache/archiva.git
synced 2025-02-06 18:19:02 +00:00
remove temporary indexes from indexer too
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
392019d186
commit
48314e4daa
@ -104,7 +104,7 @@ public File buildMergedIndex( Collection<String> repositoriesIds, boolean packIn
|
||||
IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation );
|
||||
indexPacker.packIndex( request );
|
||||
}
|
||||
temporaryIndexes.add( new TemporaryIndex( tempRepoFile ) );
|
||||
temporaryIndexes.add( new TemporaryIndex( tempRepoFile, tempRepoId ) );
|
||||
return indexingContext.getIndexDirectoryFile();
|
||||
}
|
||||
catch ( IOException e )
|
||||
@ -128,7 +128,15 @@ public void cleanTemporaryIndex()
|
||||
{
|
||||
try
|
||||
{
|
||||
FileUtils.deleteDirectory( temporaryIndex.directory );
|
||||
IndexingContext context = indexer.getIndexingContexts().get( temporaryIndex.indexId );
|
||||
if ( context != null )
|
||||
{
|
||||
indexer.removeIndexingContext( context, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
FileUtils.deleteDirectory( temporaryIndex.directory );
|
||||
}
|
||||
temporaryIndexes.remove( temporaryIndex );
|
||||
log.debug( "remove directory {}", temporaryIndex.directory );
|
||||
}
|
||||
@ -147,9 +155,12 @@ private static class TemporaryIndex
|
||||
|
||||
private File directory;
|
||||
|
||||
TemporaryIndex( File directory )
|
||||
private String indexId;
|
||||
|
||||
TemporaryIndex( File directory, String indexId )
|
||||
{
|
||||
this.directory = directory;
|
||||
this.indexId = indexId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user