]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1729] add MetadataRepository#hasMetadataFacet to prevent slow startup time
authorOlivier Lamy <olamy@apache.org>
Wed, 19 Dec 2012 17:08:38 +0000 (17:08 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 19 Dec 2012 17:08:38 +0000 (17:08 +0000)
better fix it looks I missed something :-)

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1423957 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/DefaultRepositoryArchivaTaskScheduler.java
archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/log4j2-test.xml

index 659ae5e392c9fc1633880f28a5dd6c3c4d29e98e..0a7891f7da4d334f17f2dab8dd2625f87482e1fe 100644 (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
index ee5a09b0aea0a93e4a4d206b42b120919097971c..5537a174f40b6201996b001004aeb672e0cff077 100644 (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>