simplify code and better variable name

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1443526 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-07 14:57:32 +00:00
parent 3e447d498c
commit e0ecff38ea
2 changed files with 13 additions and 12 deletions

View File

@ -70,7 +70,7 @@ public class DefaultIndexMerger
private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>(); private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>();
private int defaultGroupIndexTtl; private int groupMergedIndexTtl;
@Inject @Inject
public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils ) public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils )
@ -84,10 +84,7 @@ public class DefaultIndexMerger
@PostConstruct @PostConstruct
public void intialize() public void intialize()
{ {
String ttlStr = this.groupMergedIndexTtl = Integer.getInteger( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, DEFAULT_GROUP_INDEX_TTL );
System.getProperty( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, Integer.toString( DEFAULT_GROUP_INDEX_TTL ) );
this.defaultGroupIndexTtl = NumberUtils.toInt( ttlStr, DEFAULT_GROUP_INDEX_TTL );
} }
public IndexingContext buildMergedIndex( Collection<String> repositoriesIds, boolean packIndex ) public IndexingContext buildMergedIndex( Collection<String> repositoriesIds, boolean packIndex )
@ -169,6 +166,6 @@ public class DefaultIndexMerger
public int getGroupMergedIndexTtl() public int getGroupMergedIndexTtl()
{ {
return this.defaultGroupIndexTtl; return this.groupMergedIndexTtl;
} }
} }

View File

@ -87,6 +87,7 @@ import org.codehaus.plexus.digest.Digester;
import org.codehaus.plexus.digest.DigesterException; import org.codehaus.plexus.digest.DigesterException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.MarkerFactory;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -1181,11 +1182,14 @@ public class ArchivaDavResourceFactory
if ( System.currentTimeMillis() - tmp.getCreationTime() > ( indexMerger.getGroupMergedIndexTtl() * 60 if ( System.currentTimeMillis() - tmp.getCreationTime() > ( indexMerger.getGroupMergedIndexTtl() * 60
* 1000 ) ) * 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 ); indexMerger.cleanTemporaryGroupIndex( tmp );
} }
else else
{ {
log.debug( MarkerFactory.getDetachedMarker( "group.merged.index" ),
"merged index for group '{}' found in cache", groupId );
return tmp.getDirectory(); return tmp.getDirectory();
} }
} }