From: Olivier Lamy Date: Fri, 4 Nov 2011 18:29:41 +0000 (+0000) Subject: remove temporary indexes from indexer too X-Git-Tag: archiva-1.4-M2~150 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=48314e4daa76cdc817bb764982e6a5a6c91e2add;p=archiva.git remove temporary indexes from indexer too git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197703 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java index 1943e6cc7..9c0613490 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java @@ -104,7 +104,7 @@ public class DefaultIndexMerger 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 class DefaultIndexMerger { 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 @@ public class DefaultIndexMerger private File directory; - TemporaryIndex( File directory ) + private String indexId; + + TemporaryIndex( File directory, String indexId ) { this.directory = directory; + this.indexId = indexId; } @Override