[MRM-1729] add MetadataRepository#hasMetadataFacet to prevent slow startup time

better fix it looks I missed something :-)

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1423957 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-19 17:08:38 +00:00
parent 5e85bbe6b8
commit 238ed6ac69
2 changed files with 14 additions and 5 deletions

View File

@ -56,7 +56,7 @@ import java.util.Set;
/** /**
* Default implementation of a scheduling component for archiva. * Default implementation of a scheduling component for archiva.
*/ */
@Service("archivaTaskScheduler#repository") @Service( "archivaTaskScheduler#repository" )
public class DefaultRepositoryArchivaTaskScheduler public class DefaultRepositoryArchivaTaskScheduler
implements RepositoryArchivaTaskScheduler, ConfigurationListener implements RepositoryArchivaTaskScheduler, ConfigurationListener
{ {
@ -75,7 +75,7 @@ public class DefaultRepositoryArchivaTaskScheduler
* *
*/ */
@Inject @Inject
@Named(value = "taskQueue#repository-scanning") @Named( value = "taskQueue#repository-scanning" )
private TaskQueue repositoryScanningQueue; private TaskQueue repositoryScanningQueue;
/** /**
@ -88,7 +88,7 @@ public class DefaultRepositoryArchivaTaskScheduler
* *
*/ */
@Inject @Inject
@Named(value = "repositoryStatisticsManager#default") @Named( value = "repositoryStatisticsManager#default" )
private RepositoryStatisticsManager repositoryStatisticsManager; private RepositoryStatisticsManager repositoryStatisticsManager;
/** /**
@ -181,7 +181,7 @@ public class DefaultRepositoryArchivaTaskScheduler
} }
@SuppressWarnings("unchecked") @SuppressWarnings( "unchecked" )
public boolean isProcessingRepositoryTask( String repositoryId ) public boolean isProcessingRepositoryTask( String repositoryId )
{ {
synchronized ( repositoryScanningQueue ) synchronized ( repositoryScanningQueue )
@ -309,8 +309,15 @@ public class DefaultRepositoryArchivaTaskScheduler
MetadataRepository metadataRepository ) MetadataRepository metadataRepository )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
long start = System.currentTimeMillis();
return repositoryStatisticsManager.getLastStatistics( metadataRepository, repoConfig.getId() ) != null; boolean res = repositoryStatisticsManager.hasStatistics( metadataRepository, repoConfig.getId() );
long end = System.currentTimeMillis();
log.debug( "isPreviouslyScanned repo {} {} time: {} ms", repoConfig.getId(), res, ( end - start ) );
return res;
} }
// MRM-848: Pre-configured repository initially appear to be empty // MRM-848: Pre-configured repository initially appear to be empty

View File

@ -81,6 +81,8 @@
<logger name="org.apache.archiva.metadata.repository.stats.DefaultRepositoryStatisticsManager" level="debug" /> <logger name="org.apache.archiva.metadata.repository.stats.DefaultRepositoryStatisticsManager" level="debug" />
<logger name="org.apache.archiva.scheduler.repository.DefaultRepositoryArchivaTaskScheduler" level="debug"/>
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
</root> </root>