no need to create all of those objects if index already exisst

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1175926 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-26 16:04:48 +00:00
parent 534b2e8363
commit ec59e758e3
1 changed files with 10 additions and 8 deletions

View File

@ -194,6 +194,16 @@ public class ArtifactIndexingTask
List<? extends IndexCreator> indexCreators )
throws IOException, UnsupportedExistingLuceneIndexException
{
IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
if ( context != null )
{
LoggerFactory.getLogger( ArtifactIndexingTask.class ).warn(
"skip adding repository with id {} as already exists", repository.getId() );
return context;
}
String indexDir = repository.getIndexDirectory();
File managedRepository = new File( repository.getLocation() );
@ -207,14 +217,6 @@ public class ArtifactIndexingTask
indexDirectory = new File( managedRepository, ".indexer" );
}
IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
if ( context != null )
{
LoggerFactory.getLogger( ArtifactIndexingTask.class ).warn(
"skip adding repository with id {} as already exists", repository.getId() );
return context;
}
context = indexer.addIndexingContext( repository.getId(), repository.getId(), managedRepository, indexDirectory,
managedRepository.toURI().toURL().toExternalForm(),