mirror of https://github.com/apache/archiva.git
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:
parent
3e447d498c
commit
e0ecff38ea
|
@ -47,7 +47,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 1.4-M2
|
* @since 1.4-M2
|
||||||
*/
|
*/
|
||||||
@Service( "indexMerger#default" )
|
@Service("indexMerger#default")
|
||||||
public class DefaultIndexMerger
|
public class DefaultIndexMerger
|
||||||
implements IndexMerger
|
implements IndexMerger
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ import java.util.Set;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Service ("davResourceFactory#archiva")
|
@Service("davResourceFactory#archiva")
|
||||||
public class ArchivaDavResourceFactory
|
public class ArchivaDavResourceFactory
|
||||||
implements DavResourceFactory, Auditable
|
implements DavResourceFactory, Auditable
|
||||||
{
|
{
|
||||||
|
@ -139,7 +140,7 @@ public class ArchivaDavResourceFactory
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
@Named (value = "repositoryProxyConnectors#default")
|
@Named(value = "repositoryProxyConnectors#default")
|
||||||
private RepositoryProxyConnectors connectors;
|
private RepositoryProxyConnectors connectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +170,7 @@ public class ArchivaDavResourceFactory
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
@Named (value = "httpAuthenticator#basic")
|
@Named(value = "httpAuthenticator#basic")
|
||||||
private HttpAuthenticator httpAuth;
|
private HttpAuthenticator httpAuth;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -205,7 +206,7 @@ public class ArchivaDavResourceFactory
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
@Named (value = "archivaTaskScheduler#repository")
|
@Named(value = "archivaTaskScheduler#repository")
|
||||||
private RepositoryArchivaTaskScheduler scheduler;
|
private RepositoryArchivaTaskScheduler scheduler;
|
||||||
|
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue