[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.
*/
@Service("archivaTaskScheduler#repository")
@Service( "archivaTaskScheduler#repository" )
public class DefaultRepositoryArchivaTaskScheduler
implements RepositoryArchivaTaskScheduler, ConfigurationListener
{
@ -75,7 +75,7 @@ public class DefaultRepositoryArchivaTaskScheduler
*
*/
@Inject
@Named(value = "taskQueue#repository-scanning")
@Named( value = "taskQueue#repository-scanning" )
private TaskQueue repositoryScanningQueue;
/**
@ -88,7 +88,7 @@ public class DefaultRepositoryArchivaTaskScheduler
*
*/
@Inject
@Named(value = "repositoryStatisticsManager#default")
@Named( value = "repositoryStatisticsManager#default" )
private RepositoryStatisticsManager repositoryStatisticsManager;
/**
@ -181,7 +181,7 @@ public class DefaultRepositoryArchivaTaskScheduler
}
@SuppressWarnings("unchecked")
@SuppressWarnings( "unchecked" )
public boolean isProcessingRepositoryTask( String repositoryId )
{
synchronized ( repositoryScanningQueue )
@ -309,8 +309,15 @@ public class DefaultRepositoryArchivaTaskScheduler
MetadataRepository metadataRepository )
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

View File

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