]> source.dussan.org Git - archiva.git/commitdiff
simplify code and better variable name
authorOlivier Lamy <olamy@apache.org>
Thu, 7 Feb 2013 14:57:32 +0000 (14:57 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 7 Feb 2013 14:57:32 +0000 (14:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1443526 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java

index f8516456be186428fc16ae6f9d28e9c35ae53406..e4b69a97f188e2e4cde4ae8430028eb3a15b1612 100644 (file)
@@ -47,7 +47,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
  * @author Olivier Lamy
  * @since 1.4-M2
  */
-@Service( "indexMerger#default" )
+@Service("indexMerger#default")
 public class DefaultIndexMerger
     implements IndexMerger
 {
@@ -70,7 +70,7 @@ public class DefaultIndexMerger
 
     private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>();
 
-    private int defaultGroupIndexTtl;
+    private int groupMergedIndexTtl;
 
     @Inject
     public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils )
@@ -84,10 +84,7 @@ public class DefaultIndexMerger
     @PostConstruct
     public void intialize()
     {
-        String ttlStr =
-            System.getProperty( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, Integer.toString( DEFAULT_GROUP_INDEX_TTL ) );
-        this.defaultGroupIndexTtl = NumberUtils.toInt( ttlStr, DEFAULT_GROUP_INDEX_TTL );
-
+        this.groupMergedIndexTtl = Integer.getInteger( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, DEFAULT_GROUP_INDEX_TTL );
     }
 
     public IndexingContext buildMergedIndex( Collection<String> repositoriesIds, boolean packIndex )
@@ -169,6 +166,6 @@ public class DefaultIndexMerger
 
     public int getGroupMergedIndexTtl()
     {
-        return this.defaultGroupIndexTtl;
+        return this.groupMergedIndexTtl;
     }
 }
index 342b4ce52be74d5daa45f8c3c95a30a46b758783..a2b7efec0addb634e5bba6dc84a885a88247d269 100644 (file)
@@ -87,6 +87,7 @@ import org.codehaus.plexus.digest.Digester;
 import org.codehaus.plexus.digest.DigesterException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MarkerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 
@@ -108,7 +109,7 @@ import java.util.Set;
 /**
  *
  */
-@Service ("davResourceFactory#archiva")
+@Service("davResourceFactory#archiva")
 public class ArchivaDavResourceFactory
     implements DavResourceFactory, Auditable
 {
@@ -139,7 +140,7 @@ public class ArchivaDavResourceFactory
      *
      */
     @Inject
-    @Named (value = "repositoryProxyConnectors#default")
+    @Named(value = "repositoryProxyConnectors#default")
     private RepositoryProxyConnectors connectors;
 
     /**
@@ -169,7 +170,7 @@ public class ArchivaDavResourceFactory
      *
      */
     @Inject
-    @Named (value = "httpAuthenticator#basic")
+    @Named(value = "httpAuthenticator#basic")
     private HttpAuthenticator httpAuth;
 
     @Inject
@@ -205,7 +206,7 @@ public class ArchivaDavResourceFactory
      *
      */
     @Inject
-    @Named (value = "archivaTaskScheduler#repository")
+    @Named(value = "archivaTaskScheduler#repository")
     private RepositoryArchivaTaskScheduler scheduler;
 
     private ApplicationContext applicationContext;
@@ -1181,11 +1182,14 @@ public class ArchivaDavResourceFactory
                 if ( System.currentTimeMillis() - tmp.getCreationTime() > ( indexMerger.getGroupMergedIndexTtl() * 60
                     * 1000 ) )
                 {
-                    log.debug( "tmp group index is too old so delete it" );
+                    log.debug( MarkerFactory.getDetachedMarker( "group.merged.index" ),
+                               "tmp group index '{}' is too old so delete it", groupId );
                     indexMerger.cleanTemporaryGroupIndex( tmp );
                 }
                 else
                 {
+                    log.debug( MarkerFactory.getDetachedMarker( "group.merged.index" ),
+                               "merged index for group '{}' found in cache", groupId );
                     return tmp.getDirectory();
                 }
             }