indexPacker.packIndex( request );
}
temporaryGroupIndexes.add(
- new TemporaryGroupIndex( tempRepoFile, tempRepoId, indexMergerRequest.getGroupId() ) );
+ new TemporaryGroupIndex( tempRepoFile, tempRepoId, indexMergerRequest.getGroupId(), indexMergerRequest.getMergedIndexTtl() ) );
stopWatch.stop();
log.info( "merged index for repos {} in {} s", indexMergerRequest.getRepositoriesIds(),
stopWatch.getTime() );
private String mergedIndexPath = "/.indexer";
+ private int mergedIndexTtl;
+
public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId )
{
this.repositoriesIds = repositoriesIds;
/**
* @since 1.4-M4
*/
- public IndexMergerRequest( Collection<String> repositoriesIds, boolean packIndex, String groupId,
- String mergedIndexPath )
+ public IndexMergerRequest(Collection<String> repositoriesIds, boolean packIndex, String groupId,
+ String mergedIndexPath, int mergedIndexTtl)
{
this.repositoriesIds = repositoriesIds;
this.packIndex = packIndex;
this.groupId = groupId;
this.mergedIndexPath = mergedIndexPath;
+ this.mergedIndexTtl = mergedIndexTtl;
}
public Collection<String> getRepositoriesIds()
this.mergedIndexPath = mergedIndexPath;
}
+ public int getMergedIndexTtl() {
+ return mergedIndexTtl;
+ }
+
+ public void setMergedIndexTtl(int mergedIndexTtl) {
+ this.mergedIndexTtl = mergedIndexTtl;
+ }
+
@Override
public String toString()
{
sb.append( ", packIndex=" ).append( packIndex );
sb.append( ", groupId='" ).append( groupId ).append( '\'' );
sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' );
+ sb.append( ", mergedIndexTtl='" ).append( mergedIndexTtl ).append( '\'' );
sb.append( '}' );
return sb.toString();
}
private String groupId;
- public TemporaryGroupIndex( File directory, String indexId, String groupId )
+ private int mergedIndexTtl;
+
+ public TemporaryGroupIndex(File directory, String indexId, String groupId, int mergedIndexTtl)
{
this.directory = directory;
this.indexId = indexId;
this.groupId = groupId;
+ this.mergedIndexTtl = mergedIndexTtl;
}
public long getCreationTime()
this.groupId = groupId;
}
+ public int getMergedIndexTtl() {
+ return mergedIndexTtl;
+ }
+
+ public void setMergedIndexTtl(int mergedIndexTtl) {
+ this.mergedIndexTtl = mergedIndexTtl;
+ }
+
@Override
public int hashCode()
{
for ( TemporaryGroupIndex temporaryGroupIndex : indexMerger.getTemporaryGroupIndexes() )
{
// cleanup files older than the ttl
- if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > indexMerger.getGroupMergedIndexTtl() )
+ if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > temporaryGroupIndex.getMergedIndexTtl() )
{
log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() );
indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
repositoryGroupConfiguration.getId(), authzRepos );
IndexingContext indexingContext = indexMerger.buildMergedIndex(
new IndexMergerRequest( authzRepos, true, repositoryGroupConfiguration.getId(),
- repositoryGroupConfiguration.getMergedIndexPath() ) );
+ repositoryGroupConfiguration.getMergedIndexPath(), repositoryGroupConfiguration.getMergedIndexTtl() ) );
File mergedRepoDir = indexingContext.getIndexDirectoryFile();
TemporaryGroupIndex temporaryGroupIndex = new TemporaryGroupIndex( mergedRepoDir, indexingContext.getId(),
- repositoryGroupConfiguration.getId() ).setCreationTime(
- new Date().getTime() );
+ repositoryGroupConfiguration.getId(),repositoryGroupConfiguration.getMergedIndexTtl() )
+ .setCreationTime(new Date().getTime() );
temporaryGroupIndexMap.put( repositoryGroupConfiguration.getId(), temporaryGroupIndex );
session.setAttribute( TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY,
temporaryGroupIndexMap );