From ec59e758e3a356b5b0d5118b27347ea83a8b3011 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 26 Sep 2011 16:04:48 +0000 Subject: [PATCH] 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 --- .../indexing/ArtifactIndexingTask.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java index f81756290..7120eab91 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java @@ -194,6 +194,16 @@ public class ArtifactIndexingTask List 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(),